Ideal place to cleanup root cache directory in cefsimple

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Ideal place to cleanup root cache directory in cefsimple

Postby linuxcef07 » Sun Dec 24, 2023 12:04 pm

I am running cefsimple app from branch 120 (6099) on windows.
To address CEF process crashes, I am checking return value of CefInitialize() and also using unique root_cache_path value based on the process ID.
Now, cache is getting created in respective root cache directory based on unique root_cache_path.

Now, I am looking for way to cleanup these cache data once respective process work is done. I can cleanup cache data in invoking application but I am looking for proper place in cefsimple itself.
Initially, I thought of cleaning cache data before CefShutdown() in cefsimple_win.cc but sub-processess will not come to that code path.
Can someone please share the ideal place/function to cleanup cache data by each sub-process in windows?
Do I need to implement/override any method for this cleanup?
linuxcef07
Techie
 
Posts: 34
Joined: Wed Dec 20, 2023 11:57 am

Re: Ideal place to cleanup root cache directory in cefsimple

Postby ndesktop » Sun Dec 24, 2023 12:15 pm

I think cache should be set up before CefInitialize and cleaned up after CefShutdown. That, I think, excludes any CEF object methods.
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am

Re: Ideal place to cleanup root cache directory in cefsimple

Postby linuxcef07 » Sun Dec 24, 2023 1:03 pm

Thanks @ndesktop for your reply.
I am setting up unique root_cache_path for each process before CefInitialize(). It creates 4 cache directories (i believe one per subprocess) in my parent cache directory during rendering.
Is it safe to delete parent cache directory (which includes cache directories of all subprocesses) after CefShutdown() in cefsimple_win.cc?
linuxcef07
Techie
 
Posts: 34
Joined: Wed Dec 20, 2023 11:57 am

Re: Ideal place to cleanup root cache directory in cefsimple

Postby ndesktop » Sun Dec 24, 2023 3:05 pm

I did not implement this scenario. I am doing the cache initialization only in the browser process.
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am

Re: Ideal place to cleanup root cache directory in cefsimple

Postby linuxcef07 » Sun Dec 24, 2023 4:33 pm

Thanks @ndesktop for your reply.
Does anyone know the ideal cleanup place/function if I am creating unique cache directory for all processes in one parent directory?
Thanks in advance.
linuxcef07
Techie
 
Posts: 34
Joined: Wed Dec 20, 2023 11:57 am

Re: Ideal place to cleanup root cache directory in cefsimple

Postby magreenblatt » Sun Dec 24, 2023 11:08 pm

You should only configure cache path for the main process. You can then clean up the path after CefShutdown.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Ideal place to cleanup root cache directory in cefsimple

Postby linuxcef07 » Mon Dec 25, 2023 6:36 am

Thanks @magreenblatt for your reply.
I need to set unique value for CefSettings.root_cache_path as well to fix CEF issues at my end for branch 120 onward (as mentioned in https://github.com/chromiumembedded/cef/issues/3615 and https://github.com/chromiumembedded/cef/commit/a25f89f9e4a5b702de4f0e4726cfee2f4f94426b)

Also, I can see that cefsimple is still locking cache files even after CefShutdown() for long time. Because of this, my cleanup code is not working even after CefShutdown().
I found a reference which also talks about the same- https://magpcss.org/ceforum/viewtopic.php?f=6&t=18686

So I am cleaning up the cache in my application (which invokes cefsimple). Thanks
linuxcef07
Techie
 
Posts: 34
Joined: Wed Dec 20, 2023 11:57 am

Re: Ideal place to cleanup root cache directory in cefsimple

Postby finder2 » Thu Dec 28, 2023 4:14 am

I optimize cache folders after CefShutdown in the main process. It works for me.
finder2
Mentor
 
Posts: 51
Joined: Fri Jun 13, 2014 1:33 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 203 guests