Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1254)

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 2810583006: PlzNavigate: Avoid creating WebUI for subframes. (Closed)
Patch Set: @dbeam suggestion Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index 5ae522b0a7b448c1cf8ab395d06544110703e08e..25b359fbb46b36018a13877769811832db7295ec 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -719,8 +719,6 @@ RenderFrameHostImpl* RenderFrameHostManager::GetFrameHostForNavigation(
// The appropriate RenderFrameHost to commit the navigation.
RenderFrameHostImpl* navigation_rfh = nullptr;
- bool notify_webui_of_rf_creation = false;
-
// Reuse the current RenderFrameHost if its SiteInstance matches the
// navigation's.
bool no_renderer_swap = current_site_instance == dest_site_instance.get();
@@ -749,6 +747,7 @@ RenderFrameHostImpl* RenderFrameHostManager::GetFrameHostForNavigation(
request.dest_site_instance(), was_server_redirect);
}
+ bool notify_webui_of_rf_creation = false;
if (no_renderer_swap) {
// GetFrameHostForNavigation will be called more than once during a
// navigation (currently twice, on request and when it's about to commit in
@@ -759,8 +758,10 @@ RenderFrameHostImpl* RenderFrameHostManager::GetFrameHostForNavigation(
if (speculative_render_frame_host_)
DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost());
- UpdatePendingWebUIOnCurrentFrameHost(request.common_params().url,
- request.bindings());
+ if (frame_tree_node_->IsMainFrame()) {
+ UpdatePendingWebUIOnCurrentFrameHost(request.common_params().url,
+ request.bindings());
+ }
navigation_rfh = render_frame_host_.get();
@@ -785,13 +786,14 @@ RenderFrameHostImpl* RenderFrameHostManager::GetFrameHostForNavigation(
}
DCHECK(speculative_render_frame_host_);
- bool changed_web_ui = speculative_render_frame_host_->UpdatePendingWebUI(
- request.common_params().url, request.bindings());
- speculative_render_frame_host_->CommitPendingWebUI();
- DCHECK_EQ(GetNavigatingWebUI(), speculative_render_frame_host_->web_ui());
- notify_webui_of_rf_creation =
- changed_web_ui && speculative_render_frame_host_->web_ui();
-
+ if (frame_tree_node_->IsMainFrame()) {
+ bool changed_web_ui = speculative_render_frame_host_->UpdatePendingWebUI(
+ request.common_params().url, request.bindings());
+ speculative_render_frame_host_->CommitPendingWebUI();
+ DCHECK_EQ(GetNavigatingWebUI(), speculative_render_frame_host_->web_ui());
+ notify_webui_of_rf_creation =
+ changed_web_ui && speculative_render_frame_host_->web_ui();
+ }
navigation_rfh = speculative_render_frame_host_.get();
// Check if our current RFH is live.
@@ -835,7 +837,8 @@ RenderFrameHostImpl* RenderFrameHostManager::GetFrameHostForNavigation(
if (!ReinitializeRenderFrame(navigation_rfh))
return nullptr;
- notify_webui_of_rf_creation = true;
+ if (frame_tree_node_->IsMainFrame())
+ notify_webui_of_rf_creation = true;
if (navigation_rfh == render_frame_host_.get()) {
// TODO(nasko): This is a very ugly hack. The Chrome extensions process

Powered by Google App Engine
This is Rietveld 408576698