1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-12 22:07:39 +02:00

Update to CEF 95.7.12

Fix for Windows shutdown issue thanks to petko
This commit is contained in:
salvadordf
2021-10-26 10:29:58 +02:00
parent 9b90babbcb
commit f9b7447094
7 changed files with 66 additions and 26 deletions

View File

@ -3,16 +3,16 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro
CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file. CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
CEF4Delphi uses CEF 95.7.10 which includes Chromium 95.0.4638.54. CEF4Delphi uses CEF 95.7.12 which includes Chromium 95.0.4638.54.
The CEF binaries used by CEF4Delphi are available for download at Spotify : The CEF binaries used by CEF4Delphi are available for download at Spotify :
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.10%2Bg00d4ad5%2Bchromium-95.0.4638.54_windows32.tar.bz2) * [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.12%2Bg99c4ac0%2Bchromium-95.0.4638.54_windows32.tar.bz2)
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.10%2Bg00d4ad5%2Bchromium-95.0.4638.54_windows64.tar.bz2) * [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.12%2Bg99c4ac0%2Bchromium-95.0.4638.54_windows64.tar.bz2)
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.10%2Bg00d4ad5%2Bchromium-95.0.4638.54_linux32.tar.bz2) * [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.12%2Bg99c4ac0%2Bchromium-95.0.4638.54_linux32.tar.bz2)
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.10%2Bg00d4ad5%2Bchromium-95.0.4638.54_linux64.tar.bz2) * [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.12%2Bg99c4ac0%2Bchromium-95.0.4638.54_linux64.tar.bz2)
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.10%2Bg00d4ad5%2Bchromium-95.0.4638.54_linuxarm.tar.bz2) * [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.12%2Bg99c4ac0%2Bchromium-95.0.4638.54_linuxarm.tar.bz2)
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.10%2Bg00d4ad5%2Bchromium-95.0.4638.54_linuxarm64.tar.bz2) * [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.12%2Bg99c4ac0%2Bchromium-95.0.4638.54_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.10%2Bg00d4ad5%2Bchromium-95.0.4638.54_macosx64.tar.bz2) * [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_95.7.12%2Bg99c4ac0%2Bchromium-95.0.4638.54_macosx64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 11.0 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.0RC1/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. CEF4Delphi was developed and tested on Delphi 11.0 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.0RC1/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

View File

@ -216,6 +216,8 @@ type
FScreenshotMsgID : integer; FScreenshotMsgID : integer;
FMHTMLMsgID : integer; FMHTMLMsgID : integer;
FDevToolsMsgValue : ustring; FDevToolsMsgValue : ustring;
FShutdownReason : string;
FHasShutdownReason : boolean;
FResponse : TStringList; FResponse : TStringList;
FRequest : TStringList; FRequest : TStringList;
@ -1063,6 +1065,10 @@ begin
FDevToolsMsgID := 0; FDevToolsMsgID := 0;
// Windows may show this text message while shutting down the operating system
FShutdownReason := 'MiniBrowser closing...';
FHasShutdownReason := ShutdownBlockReasonCreate(Application.Handle, @FShutdownReason[1]);
// The MultiBrowserMode store all the browser references in TChromium. // The MultiBrowserMode store all the browser references in TChromium.
// The first browser reference is the browser in the main form. // The first browser reference is the browser in the main form.
// When MiniBrowser allows CEF to create child popup browsers it will also // When MiniBrowser allows CEF to create child popup browsers it will also
@ -1076,6 +1082,9 @@ end;
procedure TMiniBrowserFrm.FormDestroy(Sender: TObject); procedure TMiniBrowserFrm.FormDestroy(Sender: TObject);
begin begin
if FHasShutdownReason then
ShutdownBlockReasonDestroy(Application.Handle);
FResponse.Free; FResponse.Free;
FRequest.Free; FRequest.Free;
FNavigation.Free; FNavigation.Free;
@ -1566,12 +1575,12 @@ end;
procedure TMiniBrowserFrm.WMQueryEndSession(var aMessage: TWMQueryEndSession); procedure TMiniBrowserFrm.WMQueryEndSession(var aMessage: TWMQueryEndSession);
begin begin
// We return False (0) to close the browser correctly while we can. // We return False (0) to close the browser correctly.
// This is not what Microsoft recommends doing when an application receives // Windows may show the FShutdownReason message that we created in
// WM_QUERYENDSESSION but at least we avoid TApplication calling HALT when // TForm.OnCreate if the shutdown takes too much time.
// it receives WM_ENDSESSION. // CEF4Delphi sets the subprocesses to receive the WM_QUERYENDSESSION
// The CEF subprocesses may receive WM_QUERYENDSESSION and WM_ENDSESSION // message after the main browser process with a
// before the main process and they may crash before closing the main form. // SetProcessShutdownParameters call
aMessage.Result := 0; aMessage.Result := 0;
PostMessage(Handle, WM_CLOSE, 0, 0); PostMessage(Handle, WM_CLOSE, 0, 0);
end; end;

View File

@ -246,6 +246,9 @@ type
FResponse : TStringList; FResponse : TStringList;
FRequest : TStringList; FRequest : TStringList;
FNavigation : TStringList; FNavigation : TStringList;
FShutdownReason : string;
FHasShutdownReason : boolean;
// Variables to control when can we destroy the form safely // Variables to control when can we destroy the form safely
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
FClosing : boolean; // Set to True in the CloseQuery event. FClosing : boolean; // Set to True in the CloseQuery event.
@ -286,6 +289,7 @@ type
procedure WMMoving(var aMessage : TMessage); message WM_MOVING; procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP; procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP; procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
procedure WMQueryEndSession(var aMessage: TWMQueryEndSession); message WM_QUERYENDSESSION;
public public
procedure ShowStatusText(const aText : string); procedure ShowStatusText(const aText : string);
@ -1062,6 +1066,10 @@ begin
FDevToolsMsgID := 0; FDevToolsMsgID := 0;
// Windows may show this text message while shutting down the operating system
FShutdownReason := 'MiniBrowser closing...';
FHasShutdownReason := ShutdownBlockReasonCreate(Application.Handle, @FShutdownReason[1]);
// The MultiBrowserMode store all the browser references in TChromium. // The MultiBrowserMode store all the browser references in TChromium.
// The first browser reference is the browser in the main form. // The first browser reference is the browser in the main form.
// When MiniBrowser allows CEF to create child popup browsers it will also // When MiniBrowser allows CEF to create child popup browsers it will also
@ -1075,6 +1083,9 @@ end;
procedure TMiniBrowserFrm.FormDestroy(Sender: TObject); procedure TMiniBrowserFrm.FormDestroy(Sender: TObject);
begin begin
if FHasShutdownReason then
ShutdownBlockReasonDestroy(Application.Handle);
FResponse.Free; FResponse.Free;
FRequest.Free; FRequest.Free;
FNavigation.Free; FNavigation.Free;
@ -1608,6 +1619,18 @@ begin
if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False;
end; end;
procedure TMiniBrowserFrm.WMQueryEndSession(var aMessage: TWMQueryEndSession);
begin
// We return False (0) to close the browser correctly.
// Windows may show the FShutdownReason message that we created in
// TForm.OnCreate if the shutdown takes too much time.
// CEF4Delphi sets the subprocesses to receive the WM_QUERYENDSESSION
// message after the main browser process with a
// SetProcessShutdownParameters call
aMessage.Result := 0;
PostMessage(Handle, WM_CLOSE, 0, 0);
end;
procedure TMiniBrowserFrm.Deczoom1Click(Sender: TObject); procedure TMiniBrowserFrm.Deczoom1Click(Sender: TObject);
begin begin
Chromium1.DecZoomStep; Chromium1.DecZoomStep;

View File

@ -21,7 +21,7 @@
</CompilerOptions> </CompilerOptions>
<Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/> <Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/>
<License Value="MPL 1.1"/> <License Value="MPL 1.1"/>
<Version Major="95" Minor="7" Release="10"/> <Version Major="95" Minor="7" Release="12"/>
<Files Count="202"> <Files Count="202">
<Item1> <Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/> <Filename Value="..\source\uCEFAccessibilityHandler.pas"/>

View File

@ -66,7 +66,7 @@ uses
const const
CEF_SUPPORTED_VERSION_MAJOR = 95; CEF_SUPPORTED_VERSION_MAJOR = 95;
CEF_SUPPORTED_VERSION_MINOR = 7; CEF_SUPPORTED_VERSION_MINOR = 7;
CEF_SUPPORTED_VERSION_RELEASE = 10; CEF_SUPPORTED_VERSION_RELEASE = 12;
CEF_SUPPORTED_VERSION_BUILD = 0; CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 95; CEF_CHROMEELF_VERSION_MAJOR = 95;
@ -774,7 +774,13 @@ begin
FLastErrorMessage := ''; FLastErrorMessage := '';
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
if (FProcessType = ptBrowser) then if (FProcessType = ptBrowser) then
GetDLLVersion(ChromeElfPath, FChromeVersionInfo); GetDLLVersion(ChromeElfPath, FChromeVersionInfo)
else
// Subprocesses will be the last to be notified about the Windows shutdown.
// The main browser process will receive WM_QUERYENDSESSION before the subprocesses
// and that allows to close the application in the right order.
// See the MiniBrowser demo for all the details.
SetProcessShutdownParameters($100, SHUTDOWN_NORETRY);
{$ENDIF} {$ENDIF}
// Internal filelds // Internal filelds

View File

@ -164,6 +164,8 @@ function PathIsUNCAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name
function PathIsUNCUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsUNCW'; function PathIsUNCUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsUNCW';
function PathIsURLAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLA'; function PathIsURLAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLA';
function PathIsURLUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLW'; function PathIsURLUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLW';
function ShutdownBlockReasonCreate(hWnd: HWND; Reason: LPCWSTR): Bool; stdcall; external User32DLL;
function ShutdownBlockReasonDestroy(hWnd: HWND): Bool; stdcall; external User32DLL;
{$IFNDEF DELPHI12_UP} {$IFNDEF DELPHI12_UP}
const const

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 330, "InternalVersion" : 331,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "95.7.10.0" "Version" : "95.7.12.0"
} }
], ],
"UpdatePackageData" : { "UpdatePackageData" : {