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

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

Issue 519533002: Initial PlzNavigate RDH-side logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 6fcb94122deb087aa949dec2e8299f08e17b58d1..6776ed09e09ce6877268b8470ee05fd64e85ab3b 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -15,7 +15,6 @@
#include "content/browser/frame_host/cross_site_transferring_request.h"
#include "content/browser/frame_host/debug_urls.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
-#include "content/browser/frame_host/navigation_before_commit_info.h"
#include "content/browser/frame_host/navigation_controller_impl.h"
#include "content/browser/frame_host/navigation_entry_impl.h"
#include "content/browser/frame_host/navigation_request.h"
@@ -36,6 +35,7 @@
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_widget_host_iterator.h"
#include "content/public/browser/render_widget_host_view.h"
+#include "content/public/browser/stream_handle.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/common/content_switches.h"
@@ -106,16 +106,6 @@ RenderFrameHostManager::~RenderFrameHostManager() {
// Delete any swapped out RenderFrameHosts.
STLDeleteValues(&proxy_hosts_);
-
- // PlzNavigate
- // There is an active navigation request for this RFHM so it needs to be
- // canceled.
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableBrowserSideNavigation)) {
- if (navigation_request_.get())
- navigation_request_->CancelNavigation();
- }
-
}
void RenderFrameHostManager::Init(BrowserContext* browser_context,
@@ -596,39 +586,33 @@ void RenderFrameHostManager::OnBeginNavigation(
info.parent_is_main_frame = !frame_tree_node_->parent() ?
false : frame_tree_node_->parent()->IsMainFrame();
+ NavigationControllerImpl& controller =
+ delegate_->GetControllerForRenderManager();
+ BrowserContext* browser_context = controller.GetBrowserContext();
+
// TODO(clamy): Check if the current RFH should be initialized (in case it has
// crashed) not to display a sad tab while navigating.
// TODO(clamy): Spawn a speculative renderer process if we do not have one to
// use for the navigation.
- // If there is an ongoing request it must be canceled.
- if (navigation_request_.get())
- navigation_request_->CancelNavigation();
-
navigation_request_.reset(new NavigationRequest(
- info, frame_tree_node_->frame_tree_node_id()));
+ info, browser_context, frame_tree_node_));
navigation_request_->BeginNavigation(params.request_body);
}
// PlzNavigate
-void RenderFrameHostManager::CommitNavigation(
- const NavigationBeforeCommitInfo& info) {
+void RenderFrameHostManager::CommitNavigation(const GURL& url,
+ ResourceResponse* response,
+ scoped_ptr<StreamHandle> body) {
CHECK(CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation));
- DCHECK(navigation_request_.get());
- // Ignores navigation commits if the request ID doesn't match the current
- // active request.
- if (navigation_request_->navigation_request_id() !=
- info.navigation_request_id) {
- return;
- }
// Pick the right RenderFrameHost to commit the navigation.
SiteInstance* current_instance = render_frame_host_->GetSiteInstance();
// TODO(clamy): Replace the default values by the right ones. This may require
// some storing in RequestNavigation.
SiteInstance* new_instance = GetSiteInstanceForNavigation(
- info.navigation_url,
+ url,
NULL,
navigation_request_->info().navigation_params.transition_type,
false,
@@ -663,7 +647,7 @@ void RenderFrameHostManager::CommitNavigation(
}
frame_tree_node_->navigator()->CommitNavigation(
- render_frame_host_.get(), info);
+ render_frame_host_.get(), url, response, body.Pass());
}
void RenderFrameHostManager::Observe(

Powered by Google App Engine
This is Rietveld 408576698