From 627a77e8d2d1dc26d76f1d32a0f0e538ea4ce1fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salvador=20D=C3=ADaz=20Fau?= Date: Fri, 26 Oct 2018 10:32:10 +0200 Subject: [PATCH] Update to CEF 3.3538.1848.g1d1fe01 --- source/uCEFApplication.pas | 10 +++--- source/uCEFBaseRefCounted.pas | 63 +++++++++++++++++++++++++++++++---- source/uCEFChromium.pas | 33 ++++++++++++------ source/uCEFInterfaces.pas | 2 ++ source/uCEFMiscFunctions.pas | 18 +++++----- source/uCEFTypes.pas | 12 ++++--- source/uFMXChromium.pas | 17 +++++++--- 7 files changed, 115 insertions(+), 40 deletions(-) diff --git a/source/uCEFApplication.pas b/source/uCEFApplication.pas index b26f7e7a..9a301f64 100644 --- a/source/uCEFApplication.pas +++ b/source/uCEFApplication.pas @@ -60,14 +60,14 @@ uses const CEF_SUPPORTED_VERSION_MAJOR = 3; - CEF_SUPPORTED_VERSION_MINOR = 3497; - CEF_SUPPORTED_VERSION_RELEASE = 1841; + CEF_SUPPORTED_VERSION_MINOR = 3538; + CEF_SUPPORTED_VERSION_RELEASE = 1848; CEF_SUPPORTED_VERSION_BUILD = 0; - CEF_CHROMEELF_VERSION_MAJOR = 69; + CEF_CHROMEELF_VERSION_MAJOR = 70; CEF_CHROMEELF_VERSION_MINOR = 0; - CEF_CHROMEELF_VERSION_RELEASE = 3497; - CEF_CHROMEELF_VERSION_BUILD = 100; + CEF_CHROMEELF_VERSION_RELEASE = 3538; + CEF_CHROMEELF_VERSION_BUILD = 77; LIBCEF_DLL = 'libcef.dll'; CHROMEELF_DLL = 'chrome_elf.dll'; diff --git a/source/uCEFBaseRefCounted.pas b/source/uCEFBaseRefCounted.pas index 821b205f..1cc7f2f7 100644 --- a/source/uCEFBaseRefCounted.pas +++ b/source/uCEFBaseRefCounted.pas @@ -72,6 +72,9 @@ type protected FData: Pointer; + function HasOneRef : boolean; + function HasAtLeastOneRef : boolean; + public constructor CreateData(size: Cardinal; owned : boolean = False); virtual; destructor Destroy; override; @@ -83,6 +86,9 @@ type protected FData: Pointer; + function HasOneRef : boolean; + function HasAtLeastOneRef : boolean; + public constructor Create(data: Pointer); virtual; destructor Destroy; override; @@ -138,6 +144,18 @@ begin Result := Ord(False); end; +function cef_base_has_at_least_one_ref(self: PCefBaseRefCounted): Integer; stdcall; +var + TempObject : TObject; +begin + TempObject := CefGetObject(self); + + if (TempObject <> nil) and (TempObject is TCefBaseRefCountedOwn) then + Result := Ord(TCefBaseRefCountedOwn(TempObject).FRefCount >= 1) + else + Result := Ord(False); +end; + procedure cef_base_add_ref_owned(self: PCefBaseRefCounted); stdcall; begin // @@ -153,6 +171,11 @@ begin Result := 1; end; +function cef_base_has_at_least_one_ref_owned(self: PCefBaseRefCounted): Integer; stdcall; +begin + Result := 1; +end; + constructor TCefBaseRefCountedOwn.CreateData(size: Cardinal; owned : boolean); begin GetMem(FData, size + SizeOf(Pointer)); @@ -163,15 +186,17 @@ begin if owned then begin - PCefBaseRefCounted(FData)^.add_ref := {$IFDEF FPC}@{$ENDIF}cef_base_add_ref_owned; - PCefBaseRefCounted(FData)^.release := {$IFDEF FPC}@{$ENDIF}cef_base_release_owned; - PCefBaseRefCounted(FData)^.has_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_one_ref_owned; + PCefBaseRefCounted(FData)^.add_ref := {$IFDEF FPC}@{$ENDIF}cef_base_add_ref_owned; + PCefBaseRefCounted(FData)^.release := {$IFDEF FPC}@{$ENDIF}cef_base_release_owned; + PCefBaseRefCounted(FData)^.has_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_one_ref_owned; + PCefBaseRefCounted(FData)^.has_at_least_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_at_least_one_ref_owned; end else begin - PCefBaseRefCounted(FData)^.add_ref := {$IFDEF FPC}@{$ENDIF}cef_base_add_ref; - PCefBaseRefCounted(FData)^.release := {$IFDEF FPC}@{$ENDIF}cef_base_release_ref; - PCefBaseRefCounted(FData)^.has_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_one_ref; + PCefBaseRefCounted(FData)^.add_ref := {$IFDEF FPC}@{$ENDIF}cef_base_add_ref; + PCefBaseRefCounted(FData)^.release := {$IFDEF FPC}@{$ENDIF}cef_base_release_ref; + PCefBaseRefCounted(FData)^.has_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_one_ref; + PCefBaseRefCounted(FData)^.has_at_least_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_at_least_one_ref; end; end; @@ -206,6 +231,22 @@ begin PCefBaseRefCounted(FData)^.add_ref(PCefBaseRefCounted(FData)); end; +function TCefBaseRefCountedOwn.HasOneRef : boolean; +begin + if (FData <> nil) and Assigned(PCefBaseRefCounted(FData)^.has_one_ref) then + Result := PCefBaseRefCounted(FData)^.has_one_ref(PCefBaseRefCounted(FData)) <> 0 + else + Result := False; +end; + +function TCefBaseRefCountedOwn.HasAtLeastOneRef : boolean; +begin + if (FData <> nil) and Assigned(PCefBaseRefCounted(FData)^.has_at_least_one_ref) then + Result := PCefBaseRefCounted(FData)^.has_at_least_one_ref(PCefBaseRefCounted(FData)) <> 0 + else + Result := False; +end; + // *********************************************** // ************ TCefBaseRefCountedRef ************ @@ -262,6 +303,16 @@ begin end; end; +function TCefBaseRefCountedRef.HasOneRef : boolean; +begin + Result := (PCefBaseRefCounted(FData)^.has_one_ref(PCefBaseRefCounted(FData)) <> 0); +end; + +function TCefBaseRefCountedRef.HasAtLeastOneRef : boolean; +begin + Result := (PCefBaseRefCounted(FData)^.has_at_least_one_ref(PCefBaseRefCounted(FData)) <> 0); +end; + // ************************************************ // *********** TLoggingInterfacedObject *********** diff --git a/source/uCEFChromium.pas b/source/uCEFChromium.pas index 59947c72..619dfa03 100644 --- a/source/uCEFChromium.pas +++ b/source/uCEFChromium.pas @@ -339,6 +339,9 @@ type function SendCompMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean; procedure ToMouseEvent(grfKeyState : Longint; pt : TPoint; var aMouseEvent : TCefMouseEvent); + procedure InitializeWindowInfo(aParentHandle : HWND; aParentRect : TRect; const aWindowName : ustring); virtual; + procedure InitializeDevToolsWindowInfo(aDevTools : TWinControl); virtual; + procedure FreeAndNilStub(var aStub : pointer); procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer); procedure WndProc(var aMessage: TMessage); @@ -1147,11 +1150,7 @@ begin CreateClientHandler(aParentHandle = 0) then begin GetSettings(FBrowserSettings); - - if FIsOSR then - WindowInfoAsWindowless(FWindowInfo, FCompHandle, aWindowName) - else - WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName); + InitializeWindowInfo(aParentHandle, aParentRect, aWindowName); if (aContext <> nil) and (length(aCookiesPath) > 0) then @@ -1175,6 +1174,24 @@ begin end; end; +procedure TChromium.InitializeWindowInfo( aParentHandle : HWND; + aParentRect : TRect; + const aWindowName : ustring); +begin + if FIsOSR then + WindowInfoAsWindowless(FWindowInfo, FCompHandle, aWindowName) + else + WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName); +end; + +procedure TChromium.InitializeDevToolsWindowInfo(aDevTools : TWinControl); +begin + if (aDevTools <> nil) then + WindowInfoAsChild(FDevWindowInfo, aDevTools.Handle, aDevTools.ClientRect, aDevTools.Name) + else + WindowInfoAsPopUp(FDevWindowInfo, WindowHandle, DEVTOOLS_WINDOWNAME); +end; + procedure TChromium.InitializeDragAndDrop(const aDropTargetCtrl : TWinControl); var TempDropTarget : IDropTarget; @@ -2980,11 +2997,7 @@ begin if Initialized then begin InitializeSettings(FDevBrowserSettings); - - if (aDevTools <> nil) then - WindowInfoAsChild(FDevWindowInfo, aDevTools.Handle, aDevTools.ClientRect, aDevTools.Name) - else - WindowInfoAsPopUp(FDevWindowInfo, WindowHandle, DEVTOOLS_WINDOWNAME); + InitializeDevToolsWindowInfo(aDevTools); TempClient := TCefClientOwn.Create; diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas index 7ac14cb1..68e0146b 100644 --- a/source/uCEFInterfaces.pas +++ b/source/uCEFInterfaces.pas @@ -395,6 +395,8 @@ type ['{1F9A7B44-DCDC-4477-9180-3ADD44BDEB7B}'] function Wrap: Pointer; function SameAs(aData : Pointer) : boolean; + function HasOneRef : boolean; + function HasAtLeastOneRef : boolean; end; // TCefRunFileDialogCallback diff --git a/source/uCEFMiscFunctions.pas b/source/uCEFMiscFunctions.pas index acec22b8..163f60cc 100644 --- a/source/uCEFMiscFunctions.pas +++ b/source/uCEFMiscFunctions.pas @@ -103,9 +103,9 @@ function cef_string_utf16_copy(const src: PChar16; src_len: NativeUInt; output: function cef_string_copy(const src: PCefChar; src_len: NativeUInt; output: PCefString): Integer; {$IFDEF MSWINDOWS} -procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : THandle; aRect : TRect; const aWindowName : ustring = ''); -procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring = ''); -procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring = ''); +procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : THandle; aRect : TRect; const aWindowName : ustring = ''; aExStyle : cardinal = 0); +procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring = ''; aExStyle : cardinal = 0); +procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring = ''; aExStyle : cardinal = 0); {$ENDIF} {$IFDEF MACOS} @@ -483,9 +483,9 @@ begin end; {$IFDEF MSWINDOWS} -procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : THandle; aRect : TRect; const aWindowName : ustring); +procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : THandle; aRect : TRect; const aWindowName : ustring; aExStyle : cardinal); begin - aWindowInfo.ex_style := 0; + aWindowInfo.ex_style := aExStyle; aWindowInfo.window_name := CefString(aWindowName); aWindowInfo.style := WS_CHILD or WS_VISIBLE or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or WS_TABSTOP; aWindowInfo.x := aRect.left; @@ -498,9 +498,9 @@ begin aWindowInfo.window := 0; end; -procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring); +procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring; aExStyle : cardinal); begin - aWindowInfo.ex_style := 0; + aWindowInfo.ex_style := aExStyle; aWindowInfo.window_name := CefString(aWindowName); aWindowInfo.style := WS_OVERLAPPEDWINDOW or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or WS_VISIBLE; aWindowInfo.x := integer(CW_USEDEFAULT); @@ -513,9 +513,9 @@ begin aWindowInfo.window := 0; end; -procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring); +procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring; aExStyle : cardinal); begin - aWindowInfo.ex_style := 0; + aWindowInfo.ex_style := aExStyle; aWindowInfo.window_name := CefString(aWindowName); aWindowInfo.style := 0; aWindowInfo.x := 0; diff --git a/source/uCEFTypes.pas b/source/uCEFTypes.pas index 85a5a533..591b775e 100644 --- a/source/uCEFTypes.pas +++ b/source/uCEFTypes.pas @@ -751,7 +751,8 @@ type TCefTerminationStatus = ( TS_ABNORMAL_TERMINATION, TS_PROCESS_WAS_KILLED, - TS_PROCESS_CRASHED + TS_PROCESS_CRASHED, + TS_PROCESS_OOM ); // /include/internal/cef_types.h (cef_path_key_t) @@ -1185,10 +1186,11 @@ type // /include/capi/cef_base_capi.h (cef_base_ref_counted_t) TCefBaseRefCounted = record - size : NativeUInt; - add_ref : procedure(self: PCefBaseRefCounted); stdcall; - release : function(self: PCefBaseRefCounted): Integer; stdcall; - has_one_ref : function(self: PCefBaseRefCounted): Integer; stdcall; + size : NativeUInt; + add_ref : procedure(self: PCefBaseRefCounted); stdcall; + release : function(self: PCefBaseRefCounted): Integer; stdcall; + has_one_ref : function(self: PCefBaseRefCounted): Integer; stdcall; + has_at_least_one_ref : function(self: PCefBaseRefCounted): Integer; stdcall; end; // /include/capi/cef_base_capi.h (cef_base_scoped_t) diff --git a/source/uFMXChromium.pas b/source/uFMXChromium.pas index b61183b1..a509bc6b 100644 --- a/source/uFMXChromium.pas +++ b/source/uFMXChromium.pas @@ -319,6 +319,7 @@ type function GetParentForm : TCustomForm; {$IFDEF MSWINDOWS} + procedure InitializeWindowInfo(aParentHandle : HWND; aParentRect : TRect; const aWindowName : ustring); virtual; procedure FreeAndNilStub(var aStub : pointer); procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer); procedure BrowserCompWndProc(var aMessage: TMessage); @@ -1085,11 +1086,7 @@ begin CreateClientHandler(aParentHandle = 0) then begin GetSettings(FBrowserSettings); - - if FIsOSR then - WindowInfoAsWindowless(FWindowInfo, 0, aWindowName) - else - WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName); + InitializeWindowInfo(aParentHandle, aParentRect, aWindowName); if (aContext <> nil) and (length(aCookiesPath) > 0) then @@ -1112,6 +1109,16 @@ begin if CustomExceptionHandler('TFMXChromium.CreateBrowser', e) then raise; end; end; + +procedure TFMXChromium.InitializeWindowInfo( aParentHandle : HWND; + aParentRect : TRect; + const aWindowName : ustring); +begin + if FIsOSR then + WindowInfoAsWindowless(FWindowInfo, 0, aWindowName) + else + WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName); +end; {$ENDIF} function TFMXChromium.ShareRequestContext(var aContext : ICefRequestContext;