mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Remove usage of FrameTreeNode IDs (see issue #2421)
With the introduction of prerendering in Chromium it is now possible for RenderFrameHosts (RFH) to move between FrameTrees. As a consequence we can no longer rely on FrameTreeNode IDs to uniquely identify a RFH over its lifespan. We must now switch to using GlobalRenderFrameHostId (child_id, frame_routing_id) instead for that purpose. Additionally, we simplify existing code by using the GlobalRenderFrameHostId struct in all places that previously used a (render_process_id, render_frame_id) pair, since these concepts are equivalent. See https://crbug.com/1179502#c8 for additional background.
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/browser_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
#include "content/public/browser/focused_node_details.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
@ -252,7 +253,8 @@ void CefBrowserContentsDelegate::RenderFrameHostStateChanged(
|
||||
|
||||
void CefBrowserContentsDelegate::RenderFrameDeleted(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
const auto frame_id = CefFrameHostImpl::MakeFrameId(render_frame_host);
|
||||
const auto frame_id =
|
||||
frame_util::MakeFrameId(render_frame_host->GetGlobalId());
|
||||
browser_info_->RemoveFrame(render_frame_host);
|
||||
|
||||
if (focused_frame_ && focused_frame_->GetIdentifier() == frame_id) {
|
||||
@ -358,6 +360,7 @@ void CefBrowserContentsDelegate::DidFinishNavigation(
|
||||
return;
|
||||
|
||||
const bool is_main_frame = navigation_handle->IsInMainFrame();
|
||||
const auto global_id = frame_util::GetGlobalId(navigation_handle);
|
||||
const GURL& url =
|
||||
(error_code == net::OK ? navigation_handle->GetURL() : GURL());
|
||||
|
||||
@ -365,14 +368,13 @@ void CefBrowserContentsDelegate::DidFinishNavigation(
|
||||
|
||||
// May return NULL when starting a new navigation if the previous navigation
|
||||
// caused the renderer process to crash during load.
|
||||
CefRefPtr<CefFrameHostImpl> frame = browser_info->GetFrameForFrameTreeNode(
|
||||
navigation_handle->GetFrameTreeNodeId());
|
||||
CefRefPtr<CefFrameHostImpl> frame =
|
||||
browser_info->GetFrameForGlobalId(global_id);
|
||||
if (!frame) {
|
||||
if (is_main_frame) {
|
||||
frame = browser_info->GetMainFrame();
|
||||
} else {
|
||||
frame =
|
||||
browser_info->CreateTempSubFrame(CefFrameHostImpl::kInvalidFrameId);
|
||||
frame = browser_info->CreateTempSubFrame(frame_util::InvalidGlobalId());
|
||||
}
|
||||
}
|
||||
frame->RefreshAttributes();
|
||||
|
Reference in New Issue
Block a user