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 #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/lazy_instance.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/public/browser/browser_context.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 class SiteInstanceImpl; | 16 class SiteInstanceImpl; |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 class BrowserContext; | |
19 class SiteInstance; | 19 class SiteInstance; |
20 } | 20 } |
21 | 21 |
22 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
23 // | 23 // |
24 // BrowsingInstance class | 24 // BrowsingInstance class |
25 // | 25 // |
26 // A browsing instance corresponds to the notion of a "unit of related browsing | 26 // A browsing instance corresponds to the notion of a "unit of related browsing |
27 // contexts" in the HTML 5 spec. Intuitively, it represents a collection of | 27 // contexts" in the HTML 5 spec. Intuitively, it represents a collection of |
28 // tabs and frames that can have script connections to each other. In that | 28 // tabs and frames that can have script connections to each other. In that |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 // Map of site to SiteInstance, to ensure we only have one SiteInstance per | 131 // Map of site to SiteInstance, to ensure we only have one SiteInstance per |
132 // site. The site string should be the possibly_invalid_spec() of a GURL | 132 // site. The site string should be the possibly_invalid_spec() of a GURL |
133 // obtained with SiteInstanceImpl::GetSiteForURL. Note that this map may not | 133 // obtained with SiteInstanceImpl::GetSiteForURL. Note that this map may not |
134 // contain every active SiteInstance, because a race exists where two | 134 // contain every active SiteInstance, because a race exists where two |
135 // SiteInstances can be assigned to the same site. This is ok in rare cases. | 135 // SiteInstances can be assigned to the same site. This is ok in rare cases. |
136 // This field is only used if we are not using process-per-site. | 136 // This field is only used if we are not using process-per-site. |
137 SiteInstanceMap site_instance_map_; | 137 SiteInstanceMap site_instance_map_; |
138 | 138 |
139 // Global map of BrowserContext to SiteInstanceMap, for process-per-site. | 139 // Global map of BrowserContext to SiteInstanceMap, for process-per-site. |
140 static base::LazyInstance< | 140 static base::LazyInstance<ContextSiteInstanceMap>::Leaky |
141 ContextSiteInstanceMap, | 141 context_site_instance_map_; |
142 base::LeakyLazyInstanceTraits<ContextSiteInstanceMap> > | |
143 context_site_instance_map_; | |
144 | 142 |
145 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); | 143 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); |
146 }; | 144 }; |
147 | 145 |
148 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ | 146 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ |
OLD | NEW |