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 #if defined(OS_ANDROID) | |
17 namespace BASE_HASH_NAMESPACE { | |
18 template<> | |
19 struct hash<content::BrowserContext*> { | |
jam
2012/01/23 17:13:13
btw i just noticed that browser_context already ha
jam
2012/01/25 21:27:52
what about this one?
| |
20 std::size_t operator()(content::BrowserContext* const& ptr) const { | |
21 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | |
22 } | |
23 }; | |
24 } // BASE_HASH_NAMESPACE | |
25 #endif // OS_ANDROID | |
26 | |
16 // static | 27 // static |
17 base::LazyInstance< | 28 base::LazyInstance< |
18 BrowsingInstance::ContextSiteInstanceMap, | 29 BrowsingInstance::ContextSiteInstanceMap, |
19 base::LeakyLazyInstanceTraits<BrowsingInstance::ContextSiteInstanceMap> > | 30 base::LeakyLazyInstanceTraits<BrowsingInstance::ContextSiteInstanceMap> > |
20 BrowsingInstance::context_site_instance_map_ = | 31 BrowsingInstance::context_site_instance_map_ = |
21 LAZY_INSTANCE_INITIALIZER; | 32 LAZY_INSTANCE_INITIALIZER; |
22 | 33 |
23 BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context) | 34 BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context) |
24 : browser_context_(browser_context) { | 35 : browser_context_(browser_context) { |
25 } | 36 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 return true; | 160 return true; |
150 } | 161 } |
151 return false; | 162 return false; |
152 } | 163 } |
153 | 164 |
154 BrowsingInstance::~BrowsingInstance() { | 165 BrowsingInstance::~BrowsingInstance() { |
155 // We should only be deleted when all of the SiteInstances that refer to | 166 // We should only be deleted when all of the SiteInstances that refer to |
156 // us are gone. | 167 // us are gone. |
157 DCHECK(site_instance_map_.empty()); | 168 DCHECK(site_instance_map_.empty()); |
158 } | 169 } |
OLD | NEW |