mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Support reconnect of the mojo frame channel (fixes issue #3260)
The mojo channel used for frame communication may disconnect for a variety of reasons including frame navigation, frame destruction, or insertion into the BackForwardCache (when the browser-side frame representation is destroyed and closes the connection). When disconnect occurs we now evaluate the situation and reconnect if appropriate. Connections are now initiated solely from the renderer process and the RenderFrame is passed as an argument to FrameAttached() instead of being retrieved independently. Messages are queued while the frame is disconnected and sent only after FrameAttachedAck() is received from the browser process. The renderer process will be crashed intentionally with a "connection retry failure" message if the reconnect fails 3 times in a row.
This commit is contained in:
@@ -35,18 +35,20 @@ void CefBrowserFrame::RegisterBrowserInterfaceBindersForFrame(
|
||||
|
||||
void CefBrowserFrame::SendMessage(const std::string& name,
|
||||
base::Value arguments) {
|
||||
// Always associate with the newly created RFH, which may be speculative when
|
||||
// Always send to the newly created RFH, which may be speculative when
|
||||
// navigating cross-origin.
|
||||
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {
|
||||
host->SendMessage(name, std::move(arguments));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserFrame::FrameAttached() {
|
||||
void CefBrowserFrame::FrameAttached(
|
||||
mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
|
||||
bool reattached) {
|
||||
// Always send to the newly created RFH, which may be speculative when
|
||||
// navigating cross-origin.
|
||||
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {
|
||||
host->FrameAttached();
|
||||
host->FrameAttached(std::move(render_frame), reattached);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user