Improve logging of frame connection state (see issue #3260)

Run with "--vmodule=frame_*=1 --enable-logging=stderr --no-sandbox" on the
command-line to see these log messages from both the browser and renderer
processes.
This commit is contained in:
Marshall Greenblatt
2022-08-16 13:10:43 -04:00
parent a7e50dfe7f
commit 2bf3d536ea
5 changed files with 151 additions and 49 deletions

View File

@@ -109,8 +109,14 @@ class CefFrameImpl
void ExecuteOnLocalFrame(const std::string& function_name,
LocalFrameAction action);
enum class ConnectReason {
RENDER_FRAME_CREATED,
WAS_SHOWN,
RETRY,
};
// Initiate the connection to the BrowserFrame channel.
void ConnectBrowserFrame();
void ConnectBrowserFrame(ConnectReason reason);
// Returns the remote BrowserFrame object.
using BrowserFrameType = mojo::Remote<cef::mojom::BrowserFrame>;
@@ -119,10 +125,17 @@ class CefFrameImpl
// Called if the BrowserFrame connection attempt times out.
void OnBrowserFrameTimeout();
// Called if/when the BrowserFrame channel is disconnected. This may occur due
// to frame navigation, destruction, or insertion into the bfcache (when the
// browser-side frame representation is destroyed and closes the connection).
void OnBrowserFrameDisconnect();
enum class DisconnectReason {
DETACHED,
CONNECT_TIMEOUT,
RENDER_FRAME_DISCONNECT,
BROWSER_FRAME_DISCONNECT,
};
// Called if/when a disconnect occurs. This may occur due to frame navigation,
// destruction, or insertion into the bfcache (when the browser-side frame
// representation is destroyed and closes the connection).
void OnDisconnect(DisconnectReason reason);
// Send an action to the remote BrowserFrame. This will queue the action if
// the remote frame is not yet attached.
@@ -152,6 +165,8 @@ class CefFrameImpl
void ContextLifecycleStateChanged(
blink::mojom::blink::FrameLifecycleState state) override;
std::string GetDebugString() const;
CefBrowserImpl* browser_;
blink::WebLocalFrame* frame_;
const int64 frame_id_;