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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 #include "content/browser/renderer_host/text_input_client_message_filter.h" 96 #include "content/browser/renderer_host/text_input_client_message_filter.h"
97 #include "content/browser/renderer_host/websocket_dispatcher_host.h" 97 #include "content/browser/renderer_host/websocket_dispatcher_host.h"
98 #include "content/browser/resolve_proxy_msg_helper.h" 98 #include "content/browser/resolve_proxy_msg_helper.h"
99 #include "content/browser/service_worker/service_worker_context_wrapper.h" 99 #include "content/browser/service_worker/service_worker_context_wrapper.h"
100 #include "content/browser/service_worker/service_worker_dispatcher_host.h" 100 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
101 #include "content/browser/shared_worker/shared_worker_message_filter.h" 101 #include "content/browser/shared_worker/shared_worker_message_filter.h"
102 #include "content/browser/speech/speech_recognition_dispatcher_host.h" 102 #include "content/browser/speech/speech_recognition_dispatcher_host.h"
103 #include "content/browser/storage_partition_impl.h" 103 #include "content/browser/storage_partition_impl.h"
104 #include "content/browser/streams/stream_context.h" 104 #include "content/browser/streams/stream_context.h"
105 #include "content/browser/tracing/trace_message_filter.h" 105 #include "content/browser/tracing/trace_message_filter.h"
106 #include "content/browser/transition_request_manager.h"
106 #include "content/browser/vibration/vibration_message_filter.h" 107 #include "content/browser/vibration/vibration_message_filter.h"
107 #include "content/browser/webui/web_ui_controller_factory_registry.h" 108 #include "content/browser/webui/web_ui_controller_factory_registry.h"
108 #include "content/browser/worker_host/worker_message_filter.h" 109 #include "content/browser/worker_host/worker_message_filter.h"
109 #include "content/browser/worker_host/worker_storage_partition.h" 110 #include "content/browser/worker_host/worker_storage_partition.h"
110 #include "content/common/child_process_host_impl.h" 111 #include "content/common/child_process_host_impl.h"
111 #include "content/common/child_process_messages.h" 112 #include "content/common/child_process_messages.h"
112 #include "content/common/content_switches_internal.h" 113 #include "content/common/content_switches_internal.h"
113 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" 114 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
114 #include "content/common/gpu/client/gpu_memory_buffer_impl_shm.h" 115 #include "content/common/gpu/client/gpu_memory_buffer_impl_shm.h"
115 #include "content/common/gpu/gpu_messages.h" 116 #include "content/common/gpu/gpu_messages.h"
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 // dedicated to. Allowing no sharing is simpler for now.) This may cause 1775 // dedicated to. Allowing no sharing is simpler for now.) This may cause
1775 // resource exhaustion issues if too many sites are open at once. 1776 // resource exhaustion issues if too many sites are open at once.
1776 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 1777 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
1777 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || 1778 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) ||
1778 command_line.HasSwitch(switches::kSitePerProcess)) 1779 command_line.HasSwitch(switches::kSitePerProcess))
1779 return false; 1780 return false;
1780 1781
1781 if (run_renderer_in_process()) 1782 if (run_renderer_in_process())
1782 return true; 1783 return true;
1783 1784
1785 // If this is a transition, we want to use GetExistingProcessHost to find
1786 // the appropriate renderer process to use.
1787 if (url.SchemeIs(kNavigationTransitionScheme))
1788 return true;
1789
1784 // NOTE: Sometimes it's necessary to create more render processes than 1790 // NOTE: Sometimes it's necessary to create more render processes than
1785 // GetMaxRendererProcessCount(), for instance when we want to create 1791 // GetMaxRendererProcessCount(), for instance when we want to create
1786 // a renderer process for a browser context that has no existing 1792 // a renderer process for a browser context that has no existing
1787 // renderers. This is OK in moderation, since the 1793 // renderers. This is OK in moderation, since the
1788 // GetMaxRendererProcessCount() is conservative. 1794 // GetMaxRendererProcessCount() is conservative.
1789 if (g_all_hosts.Get().size() >= GetMaxRendererProcessCount()) 1795 if (g_all_hosts.Get().size() >= GetMaxRendererProcessCount())
1790 return true; 1796 return true;
1791 1797
1792 return GetContentClient()->browser()-> 1798 return GetContentClient()->browser()->
1793 ShouldTryToUseExistingProcessHost(browser_context, url); 1799 ShouldTryToUseExistingProcessHost(browser_context, url);
(...skipping 11 matching lines...) Expand all
1805 while (!iter.IsAtEnd()) { 1811 while (!iter.IsAtEnd()) {
1806 if (GetContentClient()->browser()->MayReuseHost(iter.GetCurrentValue()) && 1812 if (GetContentClient()->browser()->MayReuseHost(iter.GetCurrentValue()) &&
1807 RenderProcessHostImpl::IsSuitableHost( 1813 RenderProcessHostImpl::IsSuitableHost(
1808 iter.GetCurrentValue(), 1814 iter.GetCurrentValue(),
1809 browser_context, site_url)) { 1815 browser_context, site_url)) {
1810 suitable_renderers.push_back(iter.GetCurrentValue()); 1816 suitable_renderers.push_back(iter.GetCurrentValue());
1811 } 1817 }
1812 iter.Advance(); 1818 iter.Advance();
1813 } 1819 }
1814 1820
1821 int preferred_process_id =
1822 TransitionRequestManager::GetInstance()->
1823 GetPendingTransitionProcessIDByToken(site_url);
1824
1825 if (preferred_process_id != ChildProcessHost::kInvalidUniqueID) {
1826 for (std::vector<RenderProcessHost*>::iterator it =
1827 suitable_renderers.begin(); it != suitable_renderers.end(); ++it) {
1828 RenderProcessHost* current_host = *it;
1829 if (current_host->GetID() == preferred_process_id) {
1830 if (RenderProcessHostImpl::IsSuitableHost(current_host,
1831 browser_context,
1832 site_url))
1833 return current_host;
1834 break;
1835 }
1836 }
1837 }
1838
1815 // Now pick a random suitable renderer, if we have any. 1839 // Now pick a random suitable renderer, if we have any.
1816 if (!suitable_renderers.empty()) { 1840 if (!suitable_renderers.empty()) {
1817 int suitable_count = static_cast<int>(suitable_renderers.size()); 1841 int suitable_count = static_cast<int>(suitable_renderers.size());
1818 int random_index = base::RandInt(0, suitable_count - 1); 1842 int random_index = base::RandInt(0, suitable_count - 1);
1819 return suitable_renderers[random_index]; 1843 return suitable_renderers[random_index];
1820 } 1844 }
1821 1845
1822 return NULL; 1846 return NULL;
1823 } 1847 }
1824 1848
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 void RenderProcessHostImpl::GpuMemoryBufferAllocated( 2385 void RenderProcessHostImpl::GpuMemoryBufferAllocated(
2362 IPC::Message* reply, 2386 IPC::Message* reply,
2363 const gfx::GpuMemoryBufferHandle& handle) { 2387 const gfx::GpuMemoryBufferHandle& handle) {
2364 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2388 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2365 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, 2389 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
2366 handle); 2390 handle);
2367 Send(reply); 2391 Send(reply);
2368 } 2392 }
2369 2393
2370 } // namespace content 2394 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698