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 "content/browser/site_instance.h" | 9 #include "content/browser/site_instance.h" |
10 #include "content/browser/webui/web_ui_factory.h" | |
11 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
12 #include "content/public/browser/content_browser_client.h" | 11 #include "content/public/browser/content_browser_client.h" |
| 12 #include "content/public/browser/web_ui_factory.h" |
13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
14 #include "content/public/common/url_constants.h" | 14 #include "content/public/common/url_constants.h" |
15 | 15 |
16 // static | 16 // static |
17 base::LazyInstance< | 17 base::LazyInstance< |
18 BrowsingInstance::ContextSiteInstanceMap, | 18 BrowsingInstance::ContextSiteInstanceMap, |
19 base::LeakyLazyInstanceTraits<BrowsingInstance::ContextSiteInstanceMap> > | 19 base::LeakyLazyInstanceTraits<BrowsingInstance::ContextSiteInstanceMap> > |
20 BrowsingInstance::context_site_instance_map_ = | 20 BrowsingInstance::context_site_instance_map_ = |
21 LAZY_INSTANCE_INITIALIZER; | 21 LAZY_INSTANCE_INITIALIZER; |
22 | 22 |
(...skipping 14 matching lines...) Expand all Loading... |
37 // it is in process-per-tab or process-per-site-instance. | 37 // it is in process-per-tab or process-per-site-instance. |
38 // Note that --single-process may have been specified, but that affects the | 38 // Note that --single-process may have been specified, but that affects the |
39 // process creation logic in RenderProcessHost, so we do not need to worry | 39 // process creation logic in RenderProcessHost, so we do not need to worry |
40 // about it here. | 40 // about it here. |
41 | 41 |
42 if (content::GetContentClient()->browser()-> | 42 if (content::GetContentClient()->browser()-> |
43 ShouldUseProcessPerSite(browser_context_, url)) | 43 ShouldUseProcessPerSite(browser_context_, url)) |
44 return true; | 44 return true; |
45 | 45 |
46 // DevTools pages have WebUI type but should not reuse the same host. | 46 // DevTools pages have WebUI type but should not reuse the same host. |
47 if (content::WebUIFactory::Get()->UseWebUIForURL(browser_context_, url) && | 47 if (content::GetContentClient()->browser()->GetWebUIFactory()-> |
| 48 UseWebUIForURL(browser_context_, url) && |
48 !url.SchemeIs(chrome::kChromeDevToolsScheme)) { | 49 !url.SchemeIs(chrome::kChromeDevToolsScheme)) { |
49 return true; | 50 return true; |
50 } | 51 } |
51 | 52 |
52 // In all other cases, don't use process-per-site logic. | 53 // In all other cases, don't use process-per-site logic. |
53 return false; | 54 return false; |
54 } | 55 } |
55 | 56 |
56 BrowsingInstance::SiteInstanceMap* BrowsingInstance::GetSiteInstanceMap( | 57 BrowsingInstance::SiteInstanceMap* BrowsingInstance::GetSiteInstanceMap( |
57 content::BrowserContext* browser_context, const GURL& url) { | 58 content::BrowserContext* browser_context, const GURL& url) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return true; | 149 return true; |
149 } | 150 } |
150 return false; | 151 return false; |
151 } | 152 } |
152 | 153 |
153 BrowsingInstance::~BrowsingInstance() { | 154 BrowsingInstance::~BrowsingInstance() { |
154 // We should only be deleted when all of the SiteInstances that refer to | 155 // We should only be deleted when all of the SiteInstances that refer to |
155 // us are gone. | 156 // us are gone. |
156 DCHECK(site_instance_map_.empty()); | 157 DCHECK(site_instance_map_.empty()); |
157 } | 158 } |
OLD | NEW |