| 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 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // Returns whether this BrowsingInstance has registered a SiteInstance for | 67 // Returns whether this BrowsingInstance has registered a SiteInstance for |
| 68 // the site of the given URL. | 68 // the site of the given URL. |
| 69 bool HasSiteInstance(const GURL& url); | 69 bool HasSiteInstance(const GURL& url); |
| 70 | 70 |
| 71 // Get the SiteInstance responsible for rendering the given URL. Should | 71 // Get the SiteInstance responsible for rendering the given URL. Should |
| 72 // create a new one if necessary, but should not create more than one | 72 // create a new one if necessary, but should not create more than one |
| 73 // SiteInstance per site. | 73 // SiteInstance per site. |
| 74 SiteInstance* GetSiteInstanceForURL(const GURL& url); | 74 SiteInstance* GetSiteInstanceForURL(const GURL& url); |
| 75 | 75 |
| 76 // Returns a SiteInstance that should be used for subframes when an oopif is |
| 77 // required, but a dedicated process is not. This SiteInstance will be created |
| 78 // if it doesn't already exist. There is at most one of these per |
| 79 // BrowsingInstance. |
| 80 SiteInstance* GetDefaultSubframeSiteInstance(); |
| 81 |
| 76 // Adds the given SiteInstance to our map, to ensure that we do not create | 82 // Adds the given SiteInstance to our map, to ensure that we do not create |
| 77 // another SiteInstance for the same site. | 83 // another SiteInstance for the same site. |
| 78 void RegisterSiteInstance(SiteInstance* site_instance); | 84 void RegisterSiteInstance(SiteInstance* site_instance); |
| 79 | 85 |
| 80 // Removes the given SiteInstance from our map, after all references to it | 86 // Removes the given SiteInstance from our map, after all references to it |
| 81 // have been deleted. This means it is safe to create a new SiteInstance | 87 // have been deleted. This means it is safe to create a new SiteInstance |
| 82 // if the user later visits a page from this site, within this | 88 // if the user later visits a page from this site, within this |
| 83 // BrowsingInstance. | 89 // BrowsingInstance. |
| 84 void UnregisterSiteInstance(SiteInstance* site_instance); | 90 void UnregisterSiteInstance(SiteInstance* site_instance); |
| 85 | 91 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 113 // obtained with SiteInstanceImpl::GetSiteForURL. Note that this map may not | 119 // obtained with SiteInstanceImpl::GetSiteForURL. Note that this map may not |
| 114 // contain every active SiteInstance, because a race exists where two | 120 // contain every active SiteInstance, because a race exists where two |
| 115 // SiteInstances can be assigned to the same site. This is ok in rare cases. | 121 // SiteInstances can be assigned to the same site. This is ok in rare cases. |
| 116 // It also does not contain SiteInstances which have not yet been assigned a | 122 // It also does not contain SiteInstances which have not yet been assigned a |
| 117 // site, such as about:blank. See NavigatorImpl::ShouldAssignSiteForURL. | 123 // site, such as about:blank. See NavigatorImpl::ShouldAssignSiteForURL. |
| 118 SiteInstanceMap site_instance_map_; | 124 SiteInstanceMap site_instance_map_; |
| 119 | 125 |
| 120 // Number of WebContentses currently using this BrowsingInstance. | 126 // Number of WebContentses currently using this BrowsingInstance. |
| 121 size_t active_contents_count_; | 127 size_t active_contents_count_; |
| 122 | 128 |
| 129 SiteInstance* default_subframe_site_instance_ = nullptr; |
| 130 |
| 123 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); | 131 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); |
| 124 }; | 132 }; |
| 125 | 133 |
| 126 } // namespace content | 134 } // namespace content |
| 127 | 135 |
| 128 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ | 136 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ |
| OLD | NEW |