You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-08-14 21:42:50 +02:00
Added the TCefApplication.MustFreeLibrary property
This commit is contained in:
@@ -136,6 +136,7 @@ type
|
|||||||
FProcessType : TCefProcessType;
|
FProcessType : TCefProcessType;
|
||||||
FShutdownWaitTime : cardinal;
|
FShutdownWaitTime : cardinal;
|
||||||
FWidevinePath : string;
|
FWidevinePath : string;
|
||||||
|
FMustFreeLibrary : boolean;
|
||||||
|
|
||||||
FMustCreateResourceBundleHandler : boolean;
|
FMustCreateResourceBundleHandler : boolean;
|
||||||
FMustCreateBrowserProcessHandler : boolean;
|
FMustCreateBrowserProcessHandler : boolean;
|
||||||
@@ -224,6 +225,7 @@ type
|
|||||||
function Load_cef_trace_event_internal_h : boolean;
|
function Load_cef_trace_event_internal_h : boolean;
|
||||||
|
|
||||||
procedure ShutDown;
|
procedure ShutDown;
|
||||||
|
procedure FreeLibcefLibrary;
|
||||||
function ExecuteProcess(const aApp : ICefApp) : integer;
|
function ExecuteProcess(const aApp : ICefApp) : integer;
|
||||||
procedure InitializeSettings(var aSettings : TCefSettings);
|
procedure InitializeSettings(var aSettings : TCefSettings);
|
||||||
function InitializeLibrary(const aApp : ICefApp) : boolean;
|
function InitializeLibrary(const aApp : ICefApp) : boolean;
|
||||||
@@ -342,6 +344,7 @@ type
|
|||||||
property MissingLibFiles : string read FMissingLibFiles;
|
property MissingLibFiles : string read FMissingLibFiles;
|
||||||
property ShutdownWaitTime : cardinal read FShutdownWaitTime write FShutdownWaitTime;
|
property ShutdownWaitTime : cardinal read FShutdownWaitTime write FShutdownWaitTime;
|
||||||
property WidevinePath : string read FWidevinePath write FWidevinePath;
|
property WidevinePath : string read FWidevinePath write FWidevinePath;
|
||||||
|
property MustFreeLibrary : boolean read FMustFreeLibrary write FMustFreeLibrary;
|
||||||
property ChildProcessesCount : integer read GetChildProcessesCount;
|
property ChildProcessesCount : integer read GetChildProcessesCount;
|
||||||
|
|
||||||
property OnRegCustomSchemes : TOnRegisterCustomSchemes read FOnRegisterCustomSchemes write FOnRegisterCustomSchemes;
|
property OnRegCustomSchemes : TOnRegisterCustomSchemes read FOnRegisterCustomSchemes write FOnRegisterCustomSchemes;
|
||||||
@@ -452,6 +455,7 @@ begin
|
|||||||
FProcessType := ParseProcessType;
|
FProcessType := ParseProcessType;
|
||||||
FShutdownWaitTime := 0;
|
FShutdownWaitTime := 0;
|
||||||
FWidevinePath := '';
|
FWidevinePath := '';
|
||||||
|
FMustFreeLibrary := True;
|
||||||
|
|
||||||
FMustCreateResourceBundleHandler := False;
|
FMustCreateResourceBundleHandler := False;
|
||||||
FMustCreateBrowserProcessHandler := True;
|
FMustCreateBrowserProcessHandler := True;
|
||||||
@@ -509,14 +513,7 @@ begin
|
|||||||
ShutDown;
|
ShutDown;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (FLibHandle <> 0) then
|
FreeLibcefLibrary;
|
||||||
begin
|
|
||||||
FreeLibrary(FLibHandle);
|
|
||||||
FLibHandle := 0;
|
|
||||||
FLibLoaded := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
FStatus := asUnloaded;
|
|
||||||
|
|
||||||
if (FCustomCommandLines <> nil) then FreeAndNil(FCustomCommandLines);
|
if (FCustomCommandLines <> nil) then FreeAndNil(FCustomCommandLines);
|
||||||
if (FCustomCommandLineValues <> nil) then FreeAndNil(FCustomCommandLineValues);
|
if (FCustomCommandLineValues <> nil) then FreeAndNil(FCustomCommandLineValues);
|
||||||
@@ -782,6 +779,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCefApplication.FreeLibcefLibrary;
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
try
|
||||||
|
if FMustFreeLibrary and (FLibHandle <> 0) then FreeLibrary(FLibHandle);
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefApplication.FreeLibcefLibrary', e) then raise;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
FLibHandle := 0;
|
||||||
|
FLibLoaded := False;
|
||||||
|
FStatus := asUnloaded;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCefApplication.ExecuteProcess(const aApp : ICefApp) : integer;
|
function TCefApplication.ExecuteProcess(const aApp : ICefApp) : integer;
|
||||||
var
|
var
|
||||||
TempArgs : TCefMainArgs;
|
TempArgs : TCefMainArgs;
|
||||||
@@ -1306,6 +1319,15 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
|
if (FStatus <> asLoading) or FLibLoaded or (FLibHandle <> 0) then
|
||||||
|
begin
|
||||||
|
FStatus := asErrorLoadingLibrary;
|
||||||
|
TempString := 'GlobalCEFApp can only be initialized once per process.';
|
||||||
|
|
||||||
|
ShowErrorMessageDlg(TempString);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
if FSetCurrentDir then
|
if FSetCurrentDir then
|
||||||
begin
|
begin
|
||||||
TempOldDir := GetCurrentDir;
|
TempOldDir := GetCurrentDir;
|
||||||
|
Reference in New Issue
Block a user