Chromium Code Reviews| 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_SITE_INSTANCE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ | 6 #define CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/public/browser/render_process_host_observer.h" | 10 #include "content/public/browser/render_process_host_observer.h" |
| 11 #include "content/public/browser/site_instance.h" | 11 #include "content/public/browser/site_instance.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class RenderProcessHostFactory; | 15 class RenderProcessHostFactory; |
| 16 class SiteInstanceKeepAlive; | |
| 16 | 17 |
| 17 class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance, | 18 class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance, |
| 18 public RenderProcessHostObserver { | 19 public RenderProcessHostObserver { |
| 19 public: | 20 public: |
| 20 // SiteInstance interface overrides. | 21 // SiteInstance interface overrides. |
| 21 virtual int32 GetId() OVERRIDE; | 22 virtual int32 GetId() OVERRIDE; |
| 22 virtual bool HasProcess() const OVERRIDE; | 23 virtual bool HasProcess() const OVERRIDE; |
| 23 virtual RenderProcessHost* GetProcess() OVERRIDE; | 24 virtual RenderProcessHost* GetProcess() OVERRIDE; |
| 24 virtual const GURL& GetSiteURL() const OVERRIDE; | 25 virtual const GURL& GetSiteURL() const OVERRIDE; |
| 25 virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) OVERRIDE; | 26 virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) OVERRIDE; |
| 26 virtual bool IsRelatedSiteInstance(const SiteInstance* instance) OVERRIDE; | 27 virtual bool IsRelatedSiteInstance(const SiteInstance* instance) OVERRIDE; |
| 27 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 28 virtual BrowserContext* GetBrowserContext() const OVERRIDE; |
| 28 | 29 |
| 30 scoped_ptr<SiteInstanceKeepAlive> AcquireKeepAlive(); | |
| 31 | |
| 29 // Set the web site that this SiteInstance is rendering pages for. | 32 // Set the web site that this SiteInstance is rendering pages for. |
| 30 // This includes the scheme and registered domain, but not the port. If the | 33 // This includes the scheme and registered domain, but not the port. If the |
| 31 // URL does not have a valid registered domain, then the full hostname is | 34 // URL does not have a valid registered domain, then the full hostname is |
| 32 // stored. | 35 // stored. |
| 33 void SetSite(const GURL& url); | 36 void SetSite(const GURL& url); |
| 34 bool HasSite() const; | 37 bool HasSite() const; |
| 35 | 38 |
| 36 // Returns whether there is currently a related SiteInstance (registered with | 39 // Returns whether there is currently a related SiteInstance (registered with |
| 37 // BrowsingInstance) for the site of the given url. If so, we should try to | 40 // BrowsingInstance) for the site of the given url. If so, we should try to |
| 38 // avoid dedicating an unused SiteInstance to it (e.g., in a new tab). | 41 // avoid dedicating an unused SiteInstance to it (e.g., in a new tab). |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 | 120 |
| 118 // The web site that this SiteInstance is rendering pages for. | 121 // The web site that this SiteInstance is rendering pages for. |
| 119 GURL site_; | 122 GURL site_; |
| 120 | 123 |
| 121 // Whether SetSite has been called. | 124 // Whether SetSite has been called. |
| 122 bool has_site_; | 125 bool has_site_; |
| 123 | 126 |
| 124 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); | 127 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); |
| 125 }; | 128 }; |
| 126 | 129 |
| 130 class CONTENT_EXPORT SiteInstanceKeepAlive { | |
| 131 public: | |
| 132 explicit SiteInstanceKeepAlive(scoped_refptr<SiteInstanceImpl> instance); | |
|
mfomitchev
2014/02/14 16:21:36
Perhaps we should make this constructor non-puibli
| |
| 133 ~SiteInstanceKeepAlive(); | |
| 134 | |
| 135 private: | |
| 136 scoped_refptr<SiteInstanceImpl> instance_; | |
| 137 | |
| 138 DISALLOW_COPY_AND_ASSIGN(SiteInstanceKeepAlive); | |
| 139 }; | |
| 140 | |
| 127 } // namespace content | 141 } // namespace content |
| 128 | 142 |
| 129 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ | 143 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ |
| OLD | NEW |