Add CefFrameHandler callbacks for tracking CefFrame lifespan (see issue #2421)

See the new cef_frame_handler.h for complete usage documentation.

This change includes the following related enhancements:
- The newly added CefBrowser::IsValid method will return false (in the browser
  process) after CefLifeSpanHandler::OnBeforeClose is called.
- CefBrowser::GetMainFrame will return a valid object (in the browser process)
  until after CefLifeSpanHandler::OnBeforeClose is called.
- The main frame object will change during cross-origin navigation or
  re-navigation after renderer process termination. During that time,
  GetMainFrame will return the new/pending frame (in the browser process) and
  any messages that arrive for the new/pending frame will be correctly
  attributed in OnProcessMessageReceived.
- Commands to be executed in the renderer process that may fail during early
  frame initialization (ExecuteJavaScript, LoadRequest, etc.) will now be
  queued until after the JavaScript context for the frame has been created.
- Logging has been added for any commands that are dropped because they arrived
  after frame detachment.
This commit is contained in:
Marshall Greenblatt
2021-05-20 21:42:58 -04:00
parent 5ddd26e483
commit e411b513be
42 changed files with 3031 additions and 247 deletions

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=b573d2840558cbf17908a16d3e92c3196c84b1c7$
// $hash=f2b6ec1af9292dc180975a7566296b019c25772f$
//
#include "libcef_dll/cpptoc/browser_cpptoc.h"
@ -23,6 +23,22 @@ namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK browser_is_valid(struct _cef_browser_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefBrowserCppToC::Get(self)->IsValid();
// Return type: bool
return _retval;
}
struct _cef_browser_host_t* CEF_CALLBACK
browser_get_host(struct _cef_browser_t* self) {
shutdown_checker::AssertNotShutdown();
@ -378,6 +394,7 @@ void CEF_CALLBACK browser_get_frame_names(struct _cef_browser_t* self,
// CONSTRUCTOR - Do not edit by hand.
CefBrowserCppToC::CefBrowserCppToC() {
GetStruct()->is_valid = browser_is_valid;
GetStruct()->get_host = browser_get_host;
GetStruct()->can_go_back = browser_can_go_back;
GetStruct()->go_back = browser_go_back;