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 #ifndef CONTENT_BROWSER_BROWSING_INSTANCE_H_ | 5 #ifndef CONTENT_BROWSER_BROWSING_INSTANCE_H_ |
6 #define CONTENT_BROWSER_BROWSING_INSTANCE_H_ | 6 #define CONTENT_BROWSER_BROWSING_INSTANCE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
| 10 #include "base/lazy_instance.h" |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
12 | 13 |
13 class GURL; | 14 class GURL; |
14 class SiteInstance; | 15 class SiteInstance; |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class BrowserContext; | 18 class BrowserContext; |
18 } | 19 } |
19 | 20 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 126 |
126 // Map of site to SiteInstance, to ensure we only have one SiteInstance per | 127 // Map of site to SiteInstance, to ensure we only have one SiteInstance per |
127 // site. The site string should be the possibly_invalid_spec() of a GURL | 128 // site. The site string should be the possibly_invalid_spec() of a GURL |
128 // obtained with SiteInstance::GetSiteForURL. Note that this map may not | 129 // obtained with SiteInstance::GetSiteForURL. Note that this map may not |
129 // contain every active SiteInstance, because a race exists where two | 130 // contain every active SiteInstance, because a race exists where two |
130 // SiteInstances can be assigned to the same site. This is ok in rare cases. | 131 // SiteInstances can be assigned to the same site. This is ok in rare cases. |
131 // This field is only used if we are not using process-per-site. | 132 // This field is only used if we are not using process-per-site. |
132 SiteInstanceMap site_instance_map_; | 133 SiteInstanceMap site_instance_map_; |
133 | 134 |
134 // Global map of BrowserContext to SiteInstanceMap, for process-per-site. | 135 // Global map of BrowserContext to SiteInstanceMap, for process-per-site. |
135 static ContextSiteInstanceMap context_site_instance_map_; | 136 static base::LazyInstance< |
| 137 ContextSiteInstanceMap, |
| 138 base::LeakyLazyInstanceTraits<ContextSiteInstanceMap> > |
| 139 context_site_instance_map_; |
136 | 140 |
137 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); | 141 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); |
138 }; | 142 }; |
139 | 143 |
140 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ | 144 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ |
OLD | NEW |