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

Unified Diff: content/browser/renderer_host/render_process_host_impl.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/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 528401214dca53a59305782fae8e9122f260aa13..40ca0dd3ea81e991a9d8a69ea534a76bdbca6a08 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -103,6 +103,7 @@
#include "content/browser/storage_partition_impl.h"
#include "content/browser/streams/stream_context.h"
#include "content/browser/tracing/trace_message_filter.h"
+#include "content/browser/transition_request_manager.h"
#include "content/browser/vibration/vibration_message_filter.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/browser/worker_host/worker_message_filter.h"
@@ -1781,6 +1782,11 @@ bool RenderProcessHost::ShouldTryToUseExistingProcessHost(
if (run_renderer_in_process())
return true;
+ // If this is a transition, we want to use GetExistingProcessHost to find
+ // the appropriate renderer process to use.
+ if (url.SchemeIs(kNavigationTransitionScheme))
+ return true;
+
// NOTE: Sometimes it's necessary to create more render processes than
// GetMaxRendererProcessCount(), for instance when we want to create
// a renderer process for a browser context that has no existing
@@ -1812,6 +1818,24 @@ RenderProcessHost* RenderProcessHost::GetExistingProcessHost(
iter.Advance();
}
+ int preferred_process_id =
+ TransitionRequestManager::GetInstance()->
+ GetPendingTransitionProcessIDByToken(site_url);
+
+ if (preferred_process_id != ChildProcessHost::kInvalidUniqueID) {
+ for (std::vector<RenderProcessHost*>::iterator it =
+ suitable_renderers.begin(); it != suitable_renderers.end(); ++it) {
+ RenderProcessHost* current_host = *it;
+ if (current_host->GetID() == preferred_process_id) {
+ if (RenderProcessHostImpl::IsSuitableHost(current_host,
+ browser_context,
+ site_url))
+ return current_host;
+ break;
+ }
+ }
+ }
+
// Now pick a random suitable renderer, if we have any.
if (!suitable_renderers.empty()) {
int suitable_count = static_cast<int>(suitable_renderers.size());

Powered by Google App Engine
This is Rietveld 408576698