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 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1513 if (!suitable_renderers.empty()) { | 1513 if (!suitable_renderers.empty()) { |
1514 int suitable_count = static_cast<int>(suitable_renderers.size()); | 1514 int suitable_count = static_cast<int>(suitable_renderers.size()); |
1515 int random_index = base::RandInt(0, suitable_count - 1); | 1515 int random_index = base::RandInt(0, suitable_count - 1); |
1516 return suitable_renderers[random_index]; | 1516 return suitable_renderers[random_index]; |
1517 } | 1517 } |
1518 | 1518 |
1519 return NULL; | 1519 return NULL; |
1520 } | 1520 } |
1521 | 1521 |
1522 // static | 1522 // static |
1523 bool RenderProcessHostImpl::ShouldUseProcessPerSite( | 1523 bool RenderProcessHost::ShouldUseProcessPerSite( |
1524 BrowserContext* browser_context, | 1524 BrowserContext* browser_context, |
1525 const GURL& url) { | 1525 const GURL& url) { |
1526 // Returns true if we should use the process-per-site model. This will be | 1526 // Returns true if we should use the process-per-site model. This will be |
1527 // the case if the --process-per-site switch is specified, or in | 1527 // the case if the --process-per-site switch is specified, or in |
1528 // process-per-site-instance for particular sites (e.g., WebUI). | 1528 // process-per-site-instance for particular sites (e.g., WebUI). |
1529 | 1529 |
1530 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1530 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
1531 if (command_line.HasSwitch(switches::kProcessPerSite)) | 1531 if (command_line.HasSwitch(switches::kProcessPerSite)) |
1532 return true; | 1532 return true; |
1533 | 1533 |
1534 // We want to consolidate particular sites like WebUI when we are using | 1534 // We want to consolidate particular sites like WebUI when we are using |
1535 // process-per-tab or process-per-site-instance models. | 1535 // process-per-tab or process-per-site-instance models. |
1536 // Note that --single-process is handled in ShouldTryToUseExistingProcessHost. | 1536 // Note that --single-process is handled in ShouldTryToUseExistingProcessHost. |
1537 | 1537 |
1538 if (GetContentClient()->browser()-> | 1538 if (GetContentClient()->browser()-> |
1539 ShouldUseProcessPerSite(browser_context, url)) { | 1539 ShouldUseProcessPerSite(browser_context, url)) { |
1540 return true; | 1540 return true; |
1541 } | 1541 } |
1542 | 1542 |
1543 // DevTools pages have WebUI type but should not reuse the same host. | 1543 // DevTools pages have WebUI type but should not reuse the same host. |
1544 if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( | 1544 if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( |
darin (slow to review)
2013/06/12 04:40:48
By the way, perhaps it would be better to perform
Charlie Reis
2013/06/12 18:59:16
Good point. I'll throw together a small separate
| |
1545 browser_context, url) && | 1545 browser_context, url) && |
1546 !url.SchemeIs(chrome::kChromeDevToolsScheme)) { | 1546 !url.SchemeIs(chrome::kChromeDevToolsScheme)) { |
1547 return true; | 1547 return true; |
1548 } | 1548 } |
1549 | 1549 |
1550 // In all other cases, don't use process-per-site logic. | 1550 // In all other cases, don't use process-per-site logic. |
1551 return false; | 1551 return false; |
1552 } | 1552 } |
1553 | 1553 |
1554 // static | 1554 // static |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1798 continue; | 1798 continue; |
1799 | 1799 |
1800 RenderViewHost* rvh = | 1800 RenderViewHost* rvh = |
1801 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget)); | 1801 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget)); |
1802 | 1802 |
1803 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); | 1803 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); |
1804 } | 1804 } |
1805 } | 1805 } |
1806 | 1806 |
1807 } // namespace content | 1807 } // namespace content |
OLD | NEW |