| 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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 11 #include "base/macros.h" |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 12 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 10 #include "content/public/browser/render_process_host_observer.h" | 14 #include "content/public/browser/render_process_host_observer.h" |
| 11 #include "content/public/browser/site_instance.h" | 15 #include "content/public/browser/site_instance.h" |
| 12 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 13 | 17 |
| 14 namespace content { | 18 namespace content { |
| 15 class BrowsingInstance; | 19 class BrowsingInstance; |
| 16 class RenderProcessHostFactory; | 20 class RenderProcessHostFactory; |
| 17 | 21 |
| 18 class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance, | 22 class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance, |
| 19 public RenderProcessHostObserver { | 23 public RenderProcessHostObserver { |
| 20 public: | 24 public: |
| 21 // SiteInstance interface overrides. | 25 // SiteInstance interface overrides. |
| 22 int32 GetId() override; | 26 int32_t GetId() override; |
| 23 bool HasProcess() const override; | 27 bool HasProcess() const override; |
| 24 RenderProcessHost* GetProcess() override; | 28 RenderProcessHost* GetProcess() override; |
| 25 BrowserContext* GetBrowserContext() const override; | 29 BrowserContext* GetBrowserContext() const override; |
| 26 const GURL& GetSiteURL() const override; | 30 const GURL& GetSiteURL() const override; |
| 27 SiteInstance* GetRelatedSiteInstance(const GURL& url) override; | 31 SiteInstance* GetRelatedSiteInstance(const GURL& url) override; |
| 28 bool IsRelatedSiteInstance(const SiteInstance* instance) override; | 32 bool IsRelatedSiteInstance(const SiteInstance* instance) override; |
| 29 size_t GetRelatedActiveContentsCount() override; | 33 size_t GetRelatedActiveContentsCount() override; |
| 30 bool RequiresDedicatedProcess() override; | 34 bool RequiresDedicatedProcess() override; |
| 31 | 35 |
| 32 // Set the web site that this SiteInstance is rendering pages for. | 36 // Set the web site that this SiteInstance is rendering pages for. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // RenderProcessHostObserver implementation. | 114 // RenderProcessHostObserver implementation. |
| 111 void RenderProcessHostDestroyed(RenderProcessHost* host) override; | 115 void RenderProcessHostDestroyed(RenderProcessHost* host) override; |
| 112 | 116 |
| 113 // Used to restrict a process' origin access rights. | 117 // Used to restrict a process' origin access rights. |
| 114 void LockToOrigin(); | 118 void LockToOrigin(); |
| 115 | 119 |
| 116 // An object used to construct RenderProcessHosts. | 120 // An object used to construct RenderProcessHosts. |
| 117 static const RenderProcessHostFactory* g_render_process_host_factory_; | 121 static const RenderProcessHostFactory* g_render_process_host_factory_; |
| 118 | 122 |
| 119 // The next available SiteInstance ID. | 123 // The next available SiteInstance ID. |
| 120 static int32 next_site_instance_id_; | 124 static int32_t next_site_instance_id_; |
| 121 | 125 |
| 122 // A unique ID for this SiteInstance. | 126 // A unique ID for this SiteInstance. |
| 123 int32 id_; | 127 int32_t id_; |
| 124 | 128 |
| 125 // The number of active frames in this SiteInstance. | 129 // The number of active frames in this SiteInstance. |
| 126 size_t active_frame_count_; | 130 size_t active_frame_count_; |
| 127 | 131 |
| 128 // BrowsingInstance to which this SiteInstance belongs. | 132 // BrowsingInstance to which this SiteInstance belongs. |
| 129 scoped_refptr<BrowsingInstance> browsing_instance_; | 133 scoped_refptr<BrowsingInstance> browsing_instance_; |
| 130 | 134 |
| 131 // Current RenderProcessHost that is rendering pages for this SiteInstance. | 135 // Current RenderProcessHost that is rendering pages for this SiteInstance. |
| 132 // This pointer will only change once the RenderProcessHost is destructed. It | 136 // This pointer will only change once the RenderProcessHost is destructed. It |
| 133 // will still remain the same even if the process crashes, since in that | 137 // will still remain the same even if the process crashes, since in that |
| 134 // scenario the RenderProcessHost remains the same. | 138 // scenario the RenderProcessHost remains the same. |
| 135 RenderProcessHost* process_; | 139 RenderProcessHost* process_; |
| 136 | 140 |
| 137 // The web site that this SiteInstance is rendering pages for. | 141 // The web site that this SiteInstance is rendering pages for. |
| 138 GURL site_; | 142 GURL site_; |
| 139 | 143 |
| 140 // Whether SetSite has been called. | 144 // Whether SetSite has been called. |
| 141 bool has_site_; | 145 bool has_site_; |
| 142 | 146 |
| 143 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); | 147 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); |
| 144 }; | 148 }; |
| 145 | 149 |
| 146 } // namespace content | 150 } // namespace content |
| 147 | 151 |
| 148 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ | 152 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ |
| OLD | NEW |