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

Faster browser destruction

Faster browser destruction. All timers have been removed from the demos.
Removed unnecessary client handler class in TChromium. Now there's only
an interface.
Fixed an old memory leak in popup windows.
This commit is contained in:
Salvador Diaz Fau
2017-06-11 17:48:20 +02:00
parent d0c7e0926e
commit 830117e0ca
47 changed files with 1118 additions and 864 deletions

View File

@@ -82,6 +82,7 @@ type
public
constructor Create(const events: IChromiumEvents); reintroduce; virtual;
destructor Destroy; override;
end;
implementation
@@ -227,49 +228,58 @@ end;
constructor TCustomDisplayHandler.Create(const events: IChromiumEvents);
begin
inherited Create;
FEvent := events;
end;
destructor TCustomDisplayHandler.Destroy;
begin
FEvent := nil;
inherited Destroy;
end;
procedure TCustomDisplayHandler.OnAddressChange(const browser: ICefBrowser;
const frame: ICefFrame; const url: ustring);
begin
FEvent.doOnAddressChange(browser, frame, url);
if (FEvent <> nil) then FEvent.doOnAddressChange(browser, frame, url);
end;
function TCustomDisplayHandler.OnConsoleMessage(const browser: ICefBrowser;
const message, source: ustring; line: Integer): Boolean;
begin
Result := FEvent.doOnConsoleMessage(browser, message, source, line);
if (FEvent <> nil) then
Result := FEvent.doOnConsoleMessage(browser, message, source, line)
else
Result := inherited;
end;
procedure TCustomDisplayHandler.OnFaviconUrlChange(const browser: ICefBrowser;
iconUrls: TStrings);
procedure TCustomDisplayHandler.OnFaviconUrlChange(const browser: ICefBrowser; iconUrls: TStrings);
begin
FEvent.doOnFaviconUrlChange(browser, iconUrls);
if (FEvent <> nil) then FEvent.doOnFaviconUrlChange(browser, iconUrls);
end;
procedure TCustomDisplayHandler.OnFullScreenModeChange(
const browser: ICefBrowser; fullscreen: Boolean);
procedure TCustomDisplayHandler.OnFullScreenModeChange(const browser: ICefBrowser; fullscreen: Boolean);
begin
FEvent.doOnFullScreenModeChange(browser, fullscreen);
if (FEvent <> nil) then FEvent.doOnFullScreenModeChange(browser, fullscreen);
end;
procedure TCustomDisplayHandler.OnStatusMessage(const browser: ICefBrowser;
const value: ustring);
procedure TCustomDisplayHandler.OnStatusMessage(const browser: ICefBrowser; const value: ustring);
begin
FEvent.doOnStatusMessage(browser, value);
if (FEvent <> nil) then FEvent.doOnStatusMessage(browser, value);
end;
procedure TCustomDisplayHandler.OnTitleChange(const browser: ICefBrowser;
const title: ustring);
procedure TCustomDisplayHandler.OnTitleChange(const browser: ICefBrowser; const title: ustring);
begin
FEvent.doOnTitleChange(browser, title);
if (FEvent <> nil) then FEvent.doOnTitleChange(browser, title);
end;
function TCustomDisplayHandler.OnTooltip(const browser: ICefBrowser;
var text: ustring): Boolean;
function TCustomDisplayHandler.OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean;
begin
Result := FEvent.doOnTooltip(browser, text);
if (FEvent <> nil) then
Result := FEvent.doOnTooltip(browser, text)
else
Result := inherited;
end;
end.