Page 1 of 1

CEF, cache and splash screen

Posted: Mon Sep 17, 2018 9:27 pm
by RedOctober
Hello,

I try to remove Chromium's cache at application startup:

Code: Select all

GlobalCEFApp.DeleteCache:=true;
Since it can take a lot of time, I want to show the splash screen. But my splash screen is only shown after the cache removal is complete. What I'm doing wrong? This is part of my dpr file:

Code: Select all

  GlobalCEFApp := TCefApplication.Create;

  GlobalCEFApp.LocalesDirPath := 'locales';
  GlobalCEFApp.EnableGPU := false;
  GlobalCEFApp.cache := 'cache';
  GlobalCEFApp.cookies := 'cookies';
  GlobalCEFApp.UserDataPath := 'user';

  GlobalCEFApp.DeleteCache:=true;

  if GlobalCEFApp.StartMainProcess then
  begin
    application.Initialize;

    Splash_Screen := TSplash_Screen.Create(nil);
    Splash_Screen.Show;
    Splash_Screen.Update;

    application.CreateForm(TMiniBrowserFrm, MiniBrowserFrm);

    Splash_Screen.Hide;
    Splash_Screen.Free;

    application.Run;
  end;

  GlobalCEFApp.Free;

Re: CEF, cache and splash screen

Posted: Tue Sep 18, 2018 7:58 am
by salvadordf
Hi,

The cache is deleted synchronously inside the GlobalCEFApp.StartMainProcess call and TSplash_Screen is created after that.

I'll try to rename the cache directory and delete it in a thread. In this case you won't even need a splash screen.

I'll update CEF4Delphi and OldCEF4Delphi with this modification as soon as I can.

Re: CEF, cache and splash screen

Posted: Tue Sep 18, 2018 1:39 pm
by salvadordf
I just uploaded a new version of CEF4Delphi and OldCEF4Delphi that renames and deletes the cache and cookies directories in a thread.

If there's some kind of problem renaming the directories it will try to delete the contents without a thread.