The DoClose logic is as outlined on the GeneralUsage/Browser Life Span description (although the Windows fragment is now out of date, as ParentWindowWillClose() no longer exists), and seems to be functioning correctly w.r.t. handling onbeforeunload cancelling, etc.
According to the description:
When the OS function receives the second OS close event it allows the parent window to actually close. This then results in a call to OnBeforeClose(). Make sure to release any references to the browser object in the OnBeforeClose() callback.
The containing tab closes correctly, is destructed (which releases it's reference to the CefRefPtr<CefClientHandler>), and I enter DoClose again with my "isClosing" status correctly set to true, however the OnBeforeClose is never fired. I've verified that there is only 1 RefCt remaining in the DoClose, isClosing==true case, which I am expecting to be cleared by the call to OnBeforeClose, so it appears the above description is not correct, or I have implemented something incorrectly. I have also tried forcing a call to OnBeforeClose (as well as just setting m_Browser = nullptr) in the DoClose, but that simply decreases the overall (static) m_BrowserCount.
I've seen a few other posts related to this topic, and now I'm wondering if render process cleanup is even supported in CEF (short of final exiting the parent process)? I had expected that once the associated client handler/browser references dropped to zero, the render/gpu processes would be notified and perform a clean exit.
Related posts I've seen:
* http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=11123&p=18852&hilit=ParentWindowWillClose#p18852
* http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=4120&start=20
Has anyone successfully implemented this?
My environment:
CEF3 3.1916.1701
multi-process=true
(32-bit Windows 7)