OLD | NEW |
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 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 | 1302 |
1303 // static | 1303 // static |
1304 RenderProcessHost* RenderProcessHost::FromID(int render_process_id) { | 1304 RenderProcessHost* RenderProcessHost::FromID(int render_process_id) { |
1305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1306 return g_all_hosts.Get().Lookup(render_process_id); | 1306 return g_all_hosts.Get().Lookup(render_process_id); |
1307 } | 1307 } |
1308 | 1308 |
1309 // static | 1309 // static |
1310 bool RenderProcessHost::ShouldTryToUseExistingProcessHost( | 1310 bool RenderProcessHost::ShouldTryToUseExistingProcessHost( |
1311 BrowserContext* browser_context, const GURL& url) { | 1311 BrowserContext* browser_context, const GURL& url) { |
| 1312 // Experimental: |
| 1313 // If --enable-strict-site-isolation or --site-per-process is enabled, do not |
| 1314 // try to reuse renderer processes when over the limit. (We could allow pages |
| 1315 // from the same site to share, if we knew what the given process was |
| 1316 // dedicated to. Allowing no sharing is simpler for now.) This may cause |
| 1317 // resource exhaustion issues if too many sites are open at once. |
| 1318 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 1319 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || |
| 1320 command_line.HasSwitch(switches::kSitePerProcess)) |
| 1321 return false; |
1312 | 1322 |
1313 if (run_renderer_in_process()) | 1323 if (run_renderer_in_process()) |
1314 return true; | 1324 return true; |
1315 | 1325 |
1316 // NOTE: Sometimes it's necessary to create more render processes than | 1326 // NOTE: Sometimes it's necessary to create more render processes than |
1317 // GetMaxRendererProcessCount(), for instance when we want to create | 1327 // GetMaxRendererProcessCount(), for instance when we want to create |
1318 // a renderer process for a browser context that has no existing | 1328 // a renderer process for a browser context that has no existing |
1319 // renderers. This is OK in moderation, since the | 1329 // renderers. This is OK in moderation, since the |
1320 // GetMaxRendererProcessCount() is conservative. | 1330 // GetMaxRendererProcessCount() is conservative. |
1321 if (g_all_hosts.Get().size() >= GetMaxRendererProcessCount()) | 1331 if (g_all_hosts.Get().size() >= GetMaxRendererProcessCount()) |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 int32 gpu_process_host_id) { | 1592 int32 gpu_process_host_id) { |
1583 TRACE_EVENT0("renderer_host", | 1593 TRACE_EVENT0("renderer_host", |
1584 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1594 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
1585 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1595 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
1586 gpu_process_host_id, | 1596 gpu_process_host_id, |
1587 false, | 1597 false, |
1588 0); | 1598 0); |
1589 } | 1599 } |
1590 | 1600 |
1591 } // namespace content | 1601 } // namespace content |
OLD | NEW |