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

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

Issue 701953006: PlzNavigate: Speculatively spawns a renderer process for navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR comments, mostly -- but not all -- nits. Created 5 years, 12 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/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index 6a7b78d5ad8a1d57318d0a219e390e5554370582..d3b77fb79a5e60c56c25e93d42e6913d7b87fbc0 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -533,7 +533,8 @@ void NavigatorImpl::DidNavigate(
if (!use_site_per_process)
frame_tree->root()->render_manager()->DidNavigateFrame(
- render_frame_host, params.gesture == NavigationGestureUser);
+ render_frame_host, params.gesture == NavigationGestureUser,
+ params.was_within_same_page);
}
// Save the origin of the new page. Do this before calling
@@ -549,7 +550,8 @@ void NavigatorImpl::DidNavigate(
if (use_site_per_process) {
FrameTreeNode* frame = render_frame_host->frame_tree_node();
frame->render_manager()->DidNavigateFrame(
- render_frame_host, params.gesture == NavigationGestureUser);
+ render_frame_host, params.gesture == NavigationGestureUser,
+ params.was_within_same_page);
}
// Update the site of the SiteInstance if it doesn't have one yet, unless
@@ -776,10 +778,12 @@ void NavigatorImpl::OnBeginNavigation(
info->parent_is_main_frame = !frame_tree_node->parent() ?
false : frame_tree_node->parent()->IsMainFrame();
- // TODO(clamy): Inform the RenderFrameHostManager that a navigation is about
- // to begin, so that it can speculatively spawn a new renderer if needed.
-
+ // First start the request on the IO thread.
navigation_request->BeginNavigation(info.Pass(), params.request_body);
+
+ // Then notify the RenderFrameHostManager so it can speculatively create a
+ // renderer in parallel.
+ frame_tree_node->render_manager()->BeginNavigation(common_params);
}
// PlzNavigate
@@ -804,7 +808,7 @@ void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node,
// Select an appropriate renderer to commit the navigation.
RenderFrameHostImpl* render_frame_host =
- frame_tree_node->render_manager()->GetFrameHostForNavigation(
+ frame_tree_node->render_manager()->SelectFrameHostForNavigation(
navigation_request->common_params().url,
navigation_request->common_params().transition);
CheckWebUIRendererDoesNotDisplayNormalURL(
@@ -820,6 +824,9 @@ void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) {
CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation));
navigation_request_map_.erase(frame_tree_node->frame_tree_node_id());
+ // TODO(carlosk): move this cleanup into the NavigationRequest destructor once
+ // we properly cancel ongoing navigations.
+ frame_tree_node->render_manager()->CleanUpNavigation();
}
// PlzNavigate

Powered by Google App Engine
This is Rietveld 408576698