OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "content/browser/browsing_instance.h" | 5 #include "content/browser/browsing_instance.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "content/browser/content_browser_client.h" | 10 #include "content/browser/content_browser_client.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 30 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
31 if (command_line.HasSwitch(switches::kProcessPerSite)) | 31 if (command_line.HasSwitch(switches::kProcessPerSite)) |
32 return true; | 32 return true; |
33 | 33 |
34 // We want to consolidate particular sites like extensions and WebUI whether | 34 // We want to consolidate particular sites like extensions and WebUI whether |
35 // it is in process-per-tab or process-per-site-instance. | 35 // it is in process-per-tab or process-per-site-instance. |
36 // Note that --single-process may have been specified, but that affects the | 36 // Note that --single-process may have been specified, but that affects the |
37 // process creation logic in RenderProcessHost, so we do not need to worry | 37 // process creation logic in RenderProcessHost, so we do not need to worry |
38 // about it here. | 38 // about it here. |
39 | 39 |
40 if (url.SchemeIs(chrome::kExtensionScheme)) | 40 if (content::GetContentClient()->browser()->ShouldUseProcessPerSite(profile_, |
| 41 url)) |
41 return true; | 42 return true; |
42 | 43 |
43 // DevTools pages have WebUI type but should not reuse the same host. | 44 // DevTools pages have WebUI type but should not reuse the same host. |
44 if (content::WebUIFactory::Get()->UseWebUIForURL(profile_, url) && | 45 if (content::WebUIFactory::Get()->UseWebUIForURL(profile_, url) && |
45 !url.SchemeIs(chrome::kChromeDevToolsScheme)) { | 46 !url.SchemeIs(chrome::kChromeDevToolsScheme)) { |
46 return true; | 47 return true; |
47 } | 48 } |
48 | 49 |
49 // In all other cases, don't use process-per-site logic. | 50 // In all other cases, don't use process-per-site logic. |
50 return false; | 51 return false; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return true; | 144 return true; |
144 } | 145 } |
145 return false; | 146 return false; |
146 } | 147 } |
147 | 148 |
148 BrowsingInstance::~BrowsingInstance() { | 149 BrowsingInstance::~BrowsingInstance() { |
149 // We should only be deleted when all of the SiteInstances that refer to | 150 // We should only be deleted when all of the SiteInstances that refer to |
150 // us are gone. | 151 // us are gone. |
151 DCHECK(site_instance_map_.empty()); | 152 DCHECK(site_instance_map_.empty()); |
152 } | 153 } |
OLD | NEW |