Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

CEF, cache and splash screen

Post Reply
User avatar
RedOctober
Posts: 8
Joined: Sat Jul 07, 2018 12:59 pm
Location: Montenegro
Contact:

CEF, cache and splash screen

Post 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;
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: CEF, cache and splash screen

Post 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.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: CEF, cache and splash screen

Post 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.
Post Reply