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

@ -9,6 +9,7 @@
#include "libcef/browser/thread_util.h"
#include "libcef/browser/web_plugin_impl.h"
#include "libcef/common/alloy/alloy_content_client.h"
#include "libcef/common/frame_util.h"
#include "extensions/common/constants.h"
@ -88,12 +89,12 @@ bool CefPluginServiceFilter::IsPluginAvailable(
return true;
}
auto browser_context =
CefBrowserContext::FromIDs(render_process_id, render_frame_id, -1, false);
const auto global_id = frame_util::MakeGlobalId(
render_process_id, render_frame_id, /*allow_invalid_frame_id=*/true);
auto browser_context = CefBrowserContext::FromGlobalId(global_id, false);
CefRefPtr<CefRequestContextHandler> handler;
if (browser_context) {
handler = browser_context->GetHandler(render_process_id, render_frame_id,
-1, false);
handler = browser_context->GetHandler(global_id, false);
}
if (!handler) {