Removed unused interface and more pointer checks

This commit is contained in:
Salvador Díaz Fau 2017-10-02 17:56:56 +02:00
parent 045fe07e74
commit 659092bb37
8 changed files with 117 additions and 92 deletions

View File

@ -63,6 +63,11 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''"> <PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_UsePackage>rtl;vcl;$(DCC_UsePackage)</DCC_UsePackage> <DCC_UsePackage>rtl;vcl;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''"> <PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define> <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>

View File

@ -1,14 +1,14 @@
[Closed Files] [Closed Files]
File_0=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFRequestContext.pas',0,1,44,76,80,0,0,, File_0=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas',0,1,40,62,65,0,0,,{1
File_1=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromium.pas',0,1,2291,98,2320,0,0,,{1 File_1=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFInterfaces.pas',0,1,1783,3,117,0,0,,
File_2=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFResolveCallback.pas',0,1,123,63,135,0,0,, File_2=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFBaseRefCounted.pas',0,1,63,23,85,0,0,,
File_3=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas',0,1,38,39,60,0,0,, File_3=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFMiscFunctions.pas',0,1,101,63,120,0,0,,
File_4=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromiumEvents.pas',0,1,30,31,62,0,0,, File_4=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFWriteHandler.pas',0,1,289,29,312,0,0,,
File_5=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFInterfaces.pas',0,1,1470,22,1499,0,0,, File_5=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFRequestContext.pas',0,1,44,76,80,0,0,,
File_6=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTask.pas',0,1,277,90,302,0,0,, File_6=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromium.pas',0,1,2291,98,2320,0,0,,{1
File_7=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFBrowser.pas',0,1,43,86,50,0,0,, File_7=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFResolveCallback.pas',0,1,123,63,135,0,0,,
File_8=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFMiscFunctions.pas',0,1,428,62,454,0,0,, File_8=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromiumEvents.pas',0,1,30,31,62,0,0,,
File_9=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTypes.pas',0,1,1450,1,1480,0,0,, File_9=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTask.pas',0,1,277,90,302,0,0,,
[Modules] [Modules]
Module0=default.htm Module0=default.htm
@ -38,18 +38,18 @@ ClientHeight=9417
DockedToMainForm=1 DockedToMainForm=1
BorlandEditorCodeExplorer=BorlandEditorCodeExplorer@EditWindow0 BorlandEditorCodeExplorer=BorlandEditorCodeExplorer@EditWindow0
TopPanelSize=0 TopPanelSize=0
LeftPanelSize=0 LeftPanelSize=1898
LeftPanelClients=PropertyInspector,DockSite3
LeftPanelData=00000800010100000000A219000000000000016A0700000000000001000000005D0E000009000000446F636B53697465330100000000972300001100000050726F7065727479496E73706563746F72FFFFFFFF
RightPanelSize=2000 RightPanelSize=2000
RightPanelClients=DockSite2 RightPanelClients=DockSite2,DockSite4
RightPanelData=00000800010100000000A21900000000000001D00700000000000001000000009723000009000000446F636B5369746532FFFFFFFF RightPanelData=00000800010100000000A21900000000000001D00700000000000001000000004312000009000000446F636B536974653201000000009723000009000000446F636B5369746534FFFFFFFF
BottomPanelSize=0 BottomPanelSize=0
BottomPanelClients=DockSite1,MessageView BottomPanelClients=DockSite1,MessageView
BottomPanelData=0000080001020200000009000000446F636B53697465310F0000004D65737361676556696577466F726D1234000000000000022506000000000000FFFFFFFF BottomPanelData=0000080001020200000009000000446F636B53697465310F0000004D65737361676556696577466F726D1234000000000000022506000000000000FFFFFFFF
BottomMiddlePanelSize=0 BottomMiddlePanelSize=0
BottomMiddlePanelClients=DockSite0,GraphDrawingModel BottomMiddlePanelClients=DockSite0,GraphDrawingModel
BottomMiddelPanelData=0000080001020200000009000000446F636B536974653010000000477261706844726177696E67566965779D1D00000000000002F306000000000000FFFFFFFF BottomMiddelPanelData=0000080001020200000009000000446F636B536974653010000000477261706844726177696E67566965779D1D00000000000002F306000000000000FFFFFFFF
TabDockLeftClients=PropertyInspector=0,DockSite3=1
TabDockRightClients=DockSite4=0
[View0] [View0]
CustomEditViewType=TWelcomePageView CustomEditViewType=TWelcomePageView
@ -120,11 +120,11 @@ State=0
Left=0 Left=0
Top=0 Top=0
Width=2000 Width=2000
Height=8935 Height=4305
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=2000 ClientWidth=2000
ClientHeight=8935 ClientHeight=4305
TBDockHeight=5897 TBDockHeight=5897
LRDockWidth=2352 LRDockWidth=2352
Dockable=1 Dockable=1
@ -157,12 +157,12 @@ Docked=1
State=0 State=0
Left=0 Left=0
Top=0 Top=0
Width=1875 Width=2000
Height=6794 Height=4383
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=1875 ClientWidth=2000
ClientHeight=6794 ClientHeight=4383
TBDockHeight=7152 TBDockHeight=7152
LRDockWidth=2000 LRDockWidth=2000
Dockable=1 Dockable=1
@ -212,8 +212,8 @@ Create=1
Visible=0 Visible=0
Docked=1 Docked=1
State=0 State=0
Left=-8 Left=-148
Top=-30 Top=-132
Width=1844 Width=1844
Height=3139 Height=3139
MaxLeft=-1 MaxLeft=-1
@ -266,22 +266,22 @@ StayOnTop=0
[PropertyInspector] [PropertyInspector]
PercentageSizes=1 PercentageSizes=1
Create=1 Create=1
Visible=0 Visible=1
Docked=1 Docked=1
State=0 State=0
Left=78 Left=0
Top=386 Top=357
Width=1898 Width=1898
Height=7220 Height=5415
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=1773 ClientWidth=1898
ClientHeight=6794 ClientHeight=5415
TBDockHeight=7220 TBDockHeight=7220
LRDockWidth=1898 LRDockWidth=1898
Dockable=1 Dockable=1
StayOnTop=0 StayOnTop=0
SplitPos=119 SplitPos=111
[frmDesignPreview] [frmDesignPreview]
PercentageSizes=1 PercentageSizes=1
@ -292,11 +292,11 @@ State=0
Left=0 Left=0
Top=0 Top=0
Width=2000 Width=2000
Height=6883 Height=6939
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=2000 ClientWidth=2000
ClientHeight=6883 ClientHeight=6939
TBDockHeight=5964 TBDockHeight=5964
LRDockWidth=2508 LRDockWidth=2508
Dockable=1 Dockable=1
@ -308,8 +308,8 @@ Create=1
Visible=0 Visible=0
Docked=1 Docked=1
State=0 State=0
Left=-946 Left=-898
Top=5 Top=-132
Width=2844 Width=2844
Height=6200 Height=6200
MaxLeft=-1 MaxLeft=-1
@ -327,8 +327,8 @@ Create=1
Visible=0 Visible=0
Docked=1 Docked=1
State=0 State=0
Left=-8 Left=-1026
Top=287 Top=-132
Width=273 Width=273
Height=359 Height=359
MaxLeft=-1 MaxLeft=-1
@ -451,11 +451,11 @@ State=0
Left=0 Left=0
Top=0 Top=0
Width=2336 Width=2336
Height=964 Height=1200
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=2336 ClientWidth=2336
ClientHeight=964 ClientHeight=1200
TBDockHeight=2321 TBDockHeight=2321
LRDockWidth=2820 LRDockWidth=2820
Dockable=1 Dockable=1
@ -516,11 +516,11 @@ State=0
Left=0 Left=0
Top=0 Top=0
Width=2000 Width=2000
Height=6883 Height=6939
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=2000 ClientWidth=2000
ClientHeight=6883 ClientHeight=6939
TBDockHeight=4888 TBDockHeight=4888
LRDockWidth=7148 LRDockWidth=7148
Dockable=1 Dockable=1
@ -532,8 +532,8 @@ Create=1
Visible=0 Visible=0
Docked=1 Docked=1
State=0 State=0
Left=249 Left=0
Top=709 Top=0
Width=2859 Width=2859
Height=3206 Height=3206
MaxLeft=-1 MaxLeft=-1
@ -579,12 +579,12 @@ Docked=1
State=0 State=0
Left=0 Left=0
Top=0 Top=0
Width=1773 Width=1898
Height=6794 Height=3554
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=1773 ClientWidth=1898
ClientHeight=6794 ClientHeight=3554
TBDockHeight=3677 TBDockHeight=3677
LRDockWidth=1898 LRDockWidth=1898
Dockable=1 Dockable=1
@ -599,11 +599,11 @@ State=0
Left=0 Left=0
Top=0 Top=0
Width=2000 Width=2000
Height=6883 Height=6939
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=2000 ClientWidth=2000
ClientHeight=6883 ClientHeight=6939
TBDockHeight=4888 TBDockHeight=4888
LRDockWidth=5305 LRDockWidth=5305
Dockable=1 Dockable=1
@ -664,7 +664,7 @@ Visible=0
Docked=1 Docked=1
State=0 State=0
Left=0 Left=0
Top=18 Top=0
Width=3820 Width=3820
Height=1424 Height=1424
MaxLeft=-1 MaxLeft=-1
@ -690,11 +690,11 @@ State=0
Left=0 Left=0
Top=18 Top=18
Width=2000 Width=2000
Height=9215 Height=4585
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=2000 ClientWidth=2000
ClientHeight=9215 ClientHeight=4585
TBDockHeight=7220 TBDockHeight=7220
LRDockWidth=2000 LRDockWidth=2000
Dockable=1 Dockable=1
@ -704,21 +704,21 @@ ActiveTabID=ProjectManager
TabDockClients=ProjectManager,ModelViewTool,DataExplorerContainer,frmDesignPreview,TFileExplorerForm TabDockClients=ProjectManager,ModelViewTool,DataExplorerContainer,frmDesignPreview,TFileExplorerForm
[DockSite3] [DockSite3]
HostDockSite=LeftDockTabSet HostDockSite=DockLeftPanel
DockSiteType=1 DockSiteType=1
PercentageSizes=1 PercentageSizes=1
Create=1 Create=1
Visible=0 Visible=1
Docked=1 Docked=1
State=0 State=0
Left=0 Left=0
Top=0 Top=18
Width=1898 Width=1898
Height=7220 Height=3554
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=1773 ClientWidth=1898
ClientHeight=6794 ClientHeight=3554
TBDockHeight=7220 TBDockHeight=7220
LRDockWidth=1898 LRDockWidth=1898
Dockable=1 Dockable=1
@ -728,21 +728,21 @@ ActiveTabID=StructureView
TabDockClients=StructureView,ClassBrowserTool TabDockClients=StructureView,ClassBrowserTool
[DockSite4] [DockSite4]
HostDockSite=RightTabDock HostDockSite=DockRightPanel
DockSiteType=1 DockSiteType=1
PercentageSizes=1 PercentageSizes=1
Create=1 Create=1
Visible=0 Visible=1
Docked=1 Docked=1
State=0 State=0
Left=0 Left=0
Top=0 Top=449
Width=2000 Width=2000
Height=7220 Height=4383
MaxLeft=-1 MaxLeft=-1
MaxTop=-1 MaxTop=-1
ClientWidth=1875 ClientWidth=2000
ClientHeight=6794 ClientHeight=4383
TBDockHeight=7220 TBDockHeight=7220
LRDockWidth=2000 LRDockWidth=2000
Dockable=1 Dockable=1

Binary file not shown.

View File

@ -1,9 +1,9 @@
[Stats] [Stats]
EditorSecs=187302 EditorSecs=188707
DesignerSecs=98 DesignerSecs=98
InspectorSecs=326 InspectorSecs=326
CompileSecs=5907605 CompileSecs=6047120
OtherSecs=19482 OtherSecs=19762
StartTime=22/01/2017 10:49:52 StartTime=22/01/2017 10:49:52
RealKeys=0 RealKeys=0
EffectiveKeys=0 EffectiveKeys=0

View File

@ -105,8 +105,7 @@ type
FExternalMessagePump : boolean; FExternalMessagePump : boolean;
FDeleteCache : boolean; FDeleteCache : boolean;
FDeleteCookies : boolean; FDeleteCookies : boolean;
FApp : TInternalApp; FInternalApp : TInternalApp;
FAppIntf : ICefApp;
FCustomCommandLines : TStringList; FCustomCommandLines : TStringList;
FCustomCommandLineValues : TStringList; FCustomCommandLineValues : TStringList;
FFlashEnabled : boolean; FFlashEnabled : boolean;
@ -353,8 +352,7 @@ begin
FExternalMessagePump := False; FExternalMessagePump := False;
FDeleteCache := False; FDeleteCache := False;
FDeleteCookies := False; FDeleteCookies := False;
FApp := nil; FInternalApp := nil;
FAppIntf := nil;
FFlashEnabled := True; FFlashEnabled := True;
FEnableSpellingService := True; FEnableSpellingService := True;
FEnableMediaStream := True; FEnableMediaStream := True;
@ -397,8 +395,7 @@ destructor TCefApplication.Destroy;
begin begin
ShutDown; ShutDown;
FAppIntf := nil; FInternalApp := nil;
FApp := nil;
if (FCustomCommandLines <> nil) then FreeAndNil(FCustomCommandLines); if (FCustomCommandLines <> nil) then FreeAndNil(FCustomCommandLines);
if (FCustomCommandLineValues <> nil) then FreeAndNil(FCustomCommandLineValues); if (FCustomCommandLineValues <> nil) then FreeAndNil(FCustomCommandLineValues);
@ -425,17 +422,16 @@ begin
Result := False; Result := False;
try try
if (FApp = nil) then if (FInternalApp = nil) then
begin begin
FApp := TInternalApp.Create; FInternalApp := TInternalApp.Create;
FApp.OnBeforeCommandLineProc := App_OnBeforeCommandLineProc; FInternalApp.OnBeforeCommandLineProc := App_OnBeforeCommandLineProc;
FApp.OnRegCustomSchemes := App_OnRegCustomSchemes; FInternalApp.OnRegCustomSchemes := App_OnRegCustomSchemes;
FApp.OnGetResourceBundleHandler := App_OnGetResourceBundleHandler; FInternalApp.OnGetResourceBundleHandler := App_OnGetResourceBundleHandler;
FApp.OnGetBrowserProcessHandler := App_OnGetBrowserProcessHandler; FInternalApp.OnGetBrowserProcessHandler := App_OnGetBrowserProcessHandler;
FApp.OnGetRenderProcessHandler := App_OnGetRenderProcessHandler; FInternalApp.OnGetRenderProcessHandler := App_OnGetRenderProcessHandler;
FAppIntf := FApp as ICefApp; Result := True;
Result := (FAppIntf <> nil);
end; end;
except except
on e : exception do on e : exception do
@ -672,10 +668,10 @@ function TCefApplication.ExecuteProcess : integer;
var var
TempArgs : TCefMainArgs; TempArgs : TCefMainArgs;
begin begin
if (FApp <> nil) then if (FInternalApp <> nil) then
begin begin
TempArgs.instance := HINSTANCE; TempArgs.instance := HINSTANCE;
Result := cef_execute_process(@TempArgs, FApp.Wrap, FWindowsSandboxInfo); Result := cef_execute_process(@TempArgs, FInternalApp.Wrap, FWindowsSandboxInfo);
end end
else else
Result := 0; Result := 0;
@ -724,8 +720,8 @@ begin
InitializeSettings(FAppSettings); InitializeSettings(FAppSettings);
Result := (FApp <> nil) and Result := (FInternalApp <> nil) and
(cef_initialize(@HInstance, @FAppSettings, FApp.Wrap, FWindowsSandboxInfo) <> 0) and (cef_initialize(@HInstance, @FAppSettings, FInternalApp.Wrap, FWindowsSandboxInfo) <> 0) and
InitializeCookies; InitializeCookies;
except except
on e : exception do on e : exception do

View File

@ -79,18 +79,37 @@ uses
uCEFTypes, uCEFMiscFunctions; uCEFTypes, uCEFMiscFunctions;
procedure cef_base_add_ref(self: PCefBaseRefCounted); stdcall; procedure cef_base_add_ref(self: PCefBaseRefCounted); stdcall;
var
TempObject : TObject;
begin begin
TCefBaseRefCountedOwn(CefGetObject(self))._AddRef; TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefBaseRefCountedOwn) then
TCefBaseRefCountedOwn(TempObject)._AddRef;
end; end;
function cef_base_release(self: PCefBaseRefCounted): Integer; stdcall; function cef_base_release(self: PCefBaseRefCounted): Integer; stdcall;
var
TempObject : TObject;
begin begin
Result := TCefBaseRefCountedOwn(CefGetObject(self))._Release; TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefBaseRefCountedOwn) then
Result := TCefBaseRefCountedOwn(TempObject)._Release
else
Result := 0;
end; end;
function cef_base_has_one_ref(self: PCefBaseRefCounted): Integer; stdcall; function cef_base_has_one_ref(self: PCefBaseRefCounted): Integer; stdcall;
var
TempObject : TObject;
begin begin
Result := Ord(TCefBaseRefCountedOwn(CefGetObject(self)).FRefCount = 1); TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefBaseRefCountedOwn) then
Result := Ord(TCefBaseRefCountedOwn(TempObject).FRefCount = 1)
else
Result := Ord(False);
end; end;
procedure cef_base_add_ref_owned(self: PCefBaseRefCounted); stdcall; procedure cef_base_add_ref_owned(self: PCefBaseRefCounted); stdcall;

View File

@ -1,4 +1,4 @@
// ************************************************************************ // ************************************************************************
// ***************************** CEF4Delphi ******************************* // ***************************** CEF4Delphi *******************************
// ************************************************************************ // ************************************************************************
// //
@ -10,7 +10,7 @@
// For more information about CEF4Delphi visit : // For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef // https://www.briskbard.com/index.php?lang=en&pageid=cef
// //
// Copyright © 2017 Salvador Díaz Fau. All rights reserved. // Copyright © 2017 Salvador Díaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@ -270,9 +270,14 @@ begin
end; end;
function CefGetObject(ptr: Pointer): TObject; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} function CefGetObject(ptr: Pointer): TObject; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF}
begin
if (ptr <> nil) then
begin begin
Dec(PByte(ptr), SizeOf(Pointer)); Dec(PByte(ptr), SizeOf(Pointer));
Result := TObject(PPointer(ptr)^); Result := TObject(PPointer(ptr)^);
end
else
Result := nil;
end; end;
function CefGetData(const i: ICefBaseRefCounted): Pointer; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} function CefGetData(const i: ICefBaseRefCounted): Pointer; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF}