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