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