1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Update to CEF 3.3538.1848.g1d1fe01

This commit is contained in:
Salvador Díaz Fau
2018-10-26 10:32:10 +02:00
parent 87e0dcbd84
commit 627a77e8d2
7 changed files with 115 additions and 40 deletions

View File

@@ -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 ***********