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:
Marshall Greenblatt
2021-08-19 17:07:44 -04:00
parent cfdec92624
commit 955097ea77
33 changed files with 506 additions and 781 deletions

View File

@ -13,6 +13,7 @@
namespace content {
class BrowserContext;
struct GlobalRenderFrameHostId;
class RenderFrameHost;
class RenderViewHost;
class WebContents;
@ -37,12 +38,11 @@ void GetAllGuestsForOwnerContents(content::WebContents* owner,
content::WebContents* GetOwnerForGuestContents(content::WebContents* guest);
// Returns the CefBrowserHostBase that owns the host identified by the specified
// routing IDs, if any. |is_guest_view| will be set to true if the IDs
// match a guest view associated with the returned browser instead of the
// global ID, if any. |is_guest_view| will be set to true if the ID
// matches a guest view associated with the returned browser instead of the
// browser itself.
CefRefPtr<CefBrowserHostBase> GetOwnerBrowserForFrameRoute(
int render_process_id,
int render_routing_id,
CefRefPtr<CefBrowserHostBase> GetOwnerBrowserForGlobalId(
const content::GlobalRenderFrameHostId& global_id,
bool* is_guest_view);
// Returns the CefBrowserHostBase that owns the specified |host|, if any.