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

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

Issue 378743002: Navigation transitions: Place transition page in same process as destination page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 0321d7b9a334ba7d80a0ee2fe1bd331a9cf4fe9b..ac36d9eca78f0a250104bd7c9abd2c7e79d16065 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -25,6 +25,7 @@
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/site_instance_impl.h"
+#include "content/browser/transition_request_manager.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/browser/webui/web_ui_impl.h"
#include "content/common/view_messages.h"
@@ -59,6 +60,16 @@ RenderFrameHostManager::PendingNavigationParams::PendingNavigationParams(
RenderFrameHostManager::PendingNavigationParams::~PendingNavigationParams() {}
+RenderFrameHostManager::TransitionParams::TransitionParams(
+ const GlobalRequestID& global_request_id,
+ const GURL& transition_url)
+ : global_request_id(global_request_id),
+ transition_url(transition_url) {
+}
+
+RenderFrameHostManager::TransitionParams::~TransitionParams() {
+}
+
bool RenderFrameHostManager::ClearRFHsPendingShutdown(FrameTreeNode* node) {
node->render_manager()->pending_delete_hosts_.clear();
return true;
@@ -358,22 +369,31 @@ void RenderFrameHostManager::OnCrossSiteResponse(
void RenderFrameHostManager::OnDeferredAfterResponseStarted(
const GlobalRequestID& global_request_id,
- RenderFrameHostImpl* pending_render_frame_host) {
- DCHECK(!response_started_id_.get());
+ RenderFrameHostImpl* pending_render_frame_host,
+ const GURL& transition_url) {
+ DCHECK(!response_started_params_.get());
+
+ TransitionRequestManager::GetInstance()->AddPendingTransitionProcessID(
+ transition_url, pending_render_frame_host->GetProcess()->GetID());
- response_started_id_.reset(new GlobalRequestID(global_request_id));
+ response_started_params_.reset(
+ new TransitionParams(global_request_id, transition_url));
}
void RenderFrameHostManager::ResumeResponseDeferredAtStart() {
- DCHECK(response_started_id_.get());
+ DCHECK(response_started_params_.get());
RenderProcessHostImpl* process =
static_cast<RenderProcessHostImpl*>(render_frame_host_->GetProcess());
- process->ResumeResponseDeferredAtStart(*response_started_id_);
+ process->ResumeResponseDeferredAtStart(
+ response_started_params_->global_request_id);
+
+ TransitionRequestManager::GetInstance()->ClearPendingTransitionProcessID(
+ response_started_params_->transition_url);
render_frame_host_->SetHasPendingTransitionRequest(false);
- response_started_id_.reset();
+ response_started_params_.reset();
}
void RenderFrameHostManager::SwappedOut(
@@ -760,6 +780,14 @@ SiteInstance* RenderFrameHostManager::GetSiteInstanceForEntry(
// navigation commits (in DidNavigate), unless the navigation entry was
// restored or it's a Web UI as described below.
if (!current_site_instance->HasSite()) {
+ // If the virtual transition url is set, we should use it instead so that
+ // when GetProcess() is called, the virtual transition url is used to
+ // retrieve the correct renderer.
+ if (!entry.GetVirtualURLForTransition().is_empty()) {
+ return SiteInstance::CreateForURL(browser_context,
+ entry.GetVirtualURLForTransition());
+ }
+
// If we've already created a SiteInstance for our destination, we don't
// want to use this unused SiteInstance; use the existing one. (We don't
// do this check if the current_instance has a site, because for now, we

Powered by Google App Engine
This is Rietveld 408576698