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:
@ -13,10 +13,12 @@
|
||||
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/common/app_manager.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/browser_tabstrip.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
|
||||
@ -83,8 +85,10 @@ void ChromeBrowserDelegate::WebContentsCreated(
|
||||
CefRefPtr<CefDictionaryValue> extra_info;
|
||||
|
||||
CefBrowserInfoManager::GetInstance()->WebContentsCreated(
|
||||
target_url, opener_render_process_id, opener_render_frame_id, settings,
|
||||
client, platform_delegate, extra_info);
|
||||
target_url,
|
||||
frame_util::MakeGlobalId(opener_render_process_id,
|
||||
opener_render_frame_id),
|
||||
settings, client, platform_delegate, extra_info);
|
||||
|
||||
auto opener = ChromeBrowserHostImpl::GetBrowserForContents(source_contents);
|
||||
if (!opener) {
|
||||
|
@ -86,21 +86,10 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForContents(
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<ChromeBrowserHostImpl>
|
||||
ChromeBrowserHostImpl::GetBrowserForFrameTreeNode(int frame_tree_node_id) {
|
||||
CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
REQUIRE_CHROME_RUNTIME();
|
||||
auto browser =
|
||||
CefBrowserHostBase::GetBrowserForFrameTreeNode(frame_tree_node_id);
|
||||
return static_cast<ChromeBrowserHostImpl*>(browser.get());
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
REQUIRE_CHROME_RUNTIME();
|
||||
auto browser = CefBrowserHostBase::GetBrowserForFrameRoute(render_process_id,
|
||||
render_routing_id);
|
||||
auto browser = CefBrowserHostBase::GetBrowserForGlobalId(global_id);
|
||||
return static_cast<ChromeBrowserHostImpl*>(browser.get());
|
||||
}
|
||||
|
||||
|
@ -44,13 +44,9 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
// Returns the browser associated with the specified WebContents.
|
||||
static CefRefPtr<ChromeBrowserHostImpl> GetBrowserForContents(
|
||||
const content::WebContents* contents);
|
||||
// Returns the browser associated with the specified FrameTreeNode ID.
|
||||
static CefRefPtr<ChromeBrowserHostImpl> GetBrowserForFrameTreeNode(
|
||||
int frame_tree_node_id);
|
||||
// Returns the browser associated with the specified frame routing IDs.
|
||||
static CefRefPtr<ChromeBrowserHostImpl> GetBrowserForFrameRoute(
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
// Returns the browser associated with the specified global ID.
|
||||
static CefRefPtr<ChromeBrowserHostImpl> GetBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id);
|
||||
|
||||
~ChromeBrowserHostImpl() override;
|
||||
|
||||
|
Reference in New Issue
Block a user