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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "content/common/content_export.h" |
11 | 12 |
12 class GURL; | 13 class GURL; |
13 class SiteInstance; | 14 class SiteInstance; |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 class BrowserContext; | 17 class BrowserContext; |
17 } | 18 } |
18 | 19 |
19 /////////////////////////////////////////////////////////////////////////////// | 20 /////////////////////////////////////////////////////////////////////////////// |
20 // | 21 // |
(...skipping 27 matching lines...) Expand all Loading... |
48 // have references to it. Because both classes are RefCounted, they do not | 49 // have references to it. Because both classes are RefCounted, they do not |
49 // need to be manually deleted. | 50 // need to be manually deleted. |
50 // | 51 // |
51 // Currently, the BrowsingInstance class is not visible outside of the | 52 // Currently, the BrowsingInstance class is not visible outside of the |
52 // SiteInstance class. To get a new SiteInstance that is part of the same | 53 // SiteInstance class. To get a new SiteInstance that is part of the same |
53 // BrowsingInstance, use SiteInstance::GetRelatedSiteInstance. Because of | 54 // BrowsingInstance, use SiteInstance::GetRelatedSiteInstance. Because of |
54 // this, BrowsingInstances and SiteInstances are tested together in | 55 // this, BrowsingInstances and SiteInstances are tested together in |
55 // site_instance_unittest.cc. | 56 // site_instance_unittest.cc. |
56 // | 57 // |
57 /////////////////////////////////////////////////////////////////////////////// | 58 /////////////////////////////////////////////////////////////////////////////// |
58 class BrowsingInstance : public base::RefCounted<BrowsingInstance> { | 59 class CONTENT_EXPORT BrowsingInstance |
| 60 : public base::RefCounted<BrowsingInstance> { |
59 public: | 61 public: |
60 // Create a new BrowsingInstance. | 62 // Create a new BrowsingInstance. |
61 explicit BrowsingInstance(content::BrowserContext* context); | 63 explicit BrowsingInstance(content::BrowserContext* context); |
62 | 64 |
63 // Returns whether the process-per-site model is in use (globally or just for | 65 // Returns whether the process-per-site model is in use (globally or just for |
64 // the given url), in which case we should ensure there is only one | 66 // the given url), in which case we should ensure there is only one |
65 // SiteInstance per site for the entire browser context, not just for this | 67 // SiteInstance per site for the entire browser context, not just for this |
66 // BrowsingInstance. | 68 // BrowsingInstance. |
67 virtual bool ShouldUseProcessPerSite(const GURL& url); | 69 virtual bool ShouldUseProcessPerSite(const GURL& url); |
68 | 70 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // This field is only used if we are not using process-per-site. | 131 // This field is only used if we are not using process-per-site. |
130 SiteInstanceMap site_instance_map_; | 132 SiteInstanceMap site_instance_map_; |
131 | 133 |
132 // Global map of BrowserContext to SiteInstanceMap, for process-per-site. | 134 // Global map of BrowserContext to SiteInstanceMap, for process-per-site. |
133 static ContextSiteInstanceMap context_site_instance_map_; | 135 static ContextSiteInstanceMap context_site_instance_map_; |
134 | 136 |
135 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); | 137 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); |
136 }; | 138 }; |
137 | 139 |
138 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ | 140 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ |
OLD | NEW |