Page 1 of 1

Proper terminating procedure for CEF

PostPosted: Wed Feb 01, 2017 5:53 am
by videoaudio
Hi,

I am using CEF in single process mode and all of the process life cycle is working fine as documented.

I am terminating the process as per guidelines which is working fine as listed below.
Code: Select all
1. Initialise CEF in main thread: CefInitialize() and run Cef app.
2. wait on blocking call CefRunMessageLoop() in main thread after initialising CEF
3. as soon as close request arrives --> Issue CefBrowser->GetHost()->CloseBrowser(false/*Force_close*/); in CefApp
4. Handle CefLifeSpanHandler::OnBeforeClose in CefClient and call "CefQuitMessageLoop()"
5. This would lead to exit of CefRunMessageLoop() in main thread and CEF process will exit.


Where in I see some rare cases shutdown is not clean. i.e. user issues close request while CEF is being initialized.
1. Shutdown request issued when CEF was just started and JS initialisation is being done.
2. Even when CefRunMessageLoop exits, some JS to native callbacks (which were registered during CefAPP::OnContextCreated()) will try to get executed and eventually fail.
3. Isnt that we we call CefQuitMessageLoop() all the JS to native callbacks also get cleared?

Thanks in advance.

Re: Proper terminating procedure for CEF

PostPosted: Wed Feb 22, 2017 8:24 am
by Czarek
Single process mode is not for production.