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/browser_context.h" | 9 #include "content/browser/browser_context.h" |
10 #include "content/browser/site_instance.h" | 10 #include "content/browser/site_instance.h" |
11 #include "content/browser/webui/web_ui_factory.h" | 11 #include "content/browser/webui/web_ui_factory.h" |
12 #include "content/public/browser/content_browser_client.h" | 12 #include "content/public/browser/content_browser_client.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_(base::LINKER_INITIALIZED); | 20 BrowsingInstance::context_site_instance_map_ = |
| 21 LAZY_INSTANCE_INITIALIZER; |
21 | 22 |
22 BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context) | 23 BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context) |
23 : browser_context_(browser_context) { | 24 : browser_context_(browser_context) { |
24 } | 25 } |
25 | 26 |
26 bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) { | 27 bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) { |
27 // Returns true if we should use the process-per-site model. This will be | 28 // Returns true if we should use the process-per-site model. This will be |
28 // the case if the --process-per-site switch is specified, or in | 29 // the case if the --process-per-site switch is specified, or in |
29 // process-per-site-instance for particular sites (e.g., the new tab page). | 30 // process-per-site-instance for particular sites (e.g., the new tab page). |
30 | 31 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 return true; | 148 return true; |
148 } | 149 } |
149 return false; | 150 return false; |
150 } | 151 } |
151 | 152 |
152 BrowsingInstance::~BrowsingInstance() { | 153 BrowsingInstance::~BrowsingInstance() { |
153 // We should only be deleted when all of the SiteInstances that refer to | 154 // We should only be deleted when all of the SiteInstances that refer to |
154 // us are gone. | 155 // us are gone. |
155 DCHECK(site_instance_map_.empty()); | 156 DCHECK(site_instance_map_.empty()); |
156 } | 157 } |
OLD | NEW |