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 #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_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
11 #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" | 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 using content::SiteInstance; | 16 using content::SiteInstance; |
17 | 17 |
18 // static | 18 // static |
19 base::LazyInstance< | 19 base::LazyInstance<BrowsingInstance::ContextSiteInstanceMap>::Leaky |
20 BrowsingInstance::ContextSiteInstanceMap, | 20 BrowsingInstance::context_site_instance_map_ = LAZY_INSTANCE_INITIALIZER; |
21 base::LeakyLazyInstanceTraits<BrowsingInstance::ContextSiteInstanceMap> > | |
22 BrowsingInstance::context_site_instance_map_ = | |
23 LAZY_INSTANCE_INITIALIZER; | |
24 | 21 |
25 BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context) | 22 BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context) |
26 : browser_context_(browser_context) { | 23 : browser_context_(browser_context) { |
27 } | 24 } |
28 | 25 |
29 bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) { | 26 bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) { |
30 // Returns true if we should use the process-per-site model. This will be | 27 // Returns true if we should use the process-per-site model. This will be |
31 // the case if the --process-per-site switch is specified, or in | 28 // the case if the --process-per-site switch is specified, or in |
32 // process-per-site-instance for particular sites (e.g., the new tab page). | 29 // process-per-site-instance for particular sites (e.g., the new tab page). |
33 | 30 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return true; | 151 return true; |
155 } | 152 } |
156 return false; | 153 return false; |
157 } | 154 } |
158 | 155 |
159 BrowsingInstance::~BrowsingInstance() { | 156 BrowsingInstance::~BrowsingInstance() { |
160 // We should only be deleted when all of the SiteInstances that refer to | 157 // We should only be deleted when all of the SiteInstances that refer to |
161 // us are gone. | 158 // us are gone. |
162 DCHECK(site_instance_map_.empty()); | 159 DCHECK(site_instance_map_.empty()); |
163 } | 160 } |
OLD | NEW |