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_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 // This object communicates back and forth with the RenderProcess object | 45 // This object communicates back and forth with the RenderProcess object |
| 46 // running in the renderer process. Each RenderProcessHost and RenderProcess | 46 // running in the renderer process. Each RenderProcessHost and RenderProcess |
| 47 // keeps a list of RenderView (renderer) and WebContentsImpl (browser) which | 47 // keeps a list of RenderView (renderer) and WebContentsImpl (browser) which |
| 48 // are correlated with IDs. This way, the Views and the corresponding ViewHosts | 48 // are correlated with IDs. This way, the Views and the corresponding ViewHosts |
| 49 // communicate through the two process objects. | 49 // communicate through the two process objects. |
| 50 class CONTENT_EXPORT RenderProcessHostImpl | 50 class CONTENT_EXPORT RenderProcessHostImpl |
| 51 : public RenderProcessHost, | 51 : public RenderProcessHost, |
| 52 public ChildProcessLauncher::Client, | 52 public ChildProcessLauncher::Client, |
| 53 public base::WaitableEventWatcher::Delegate { | 53 public base::WaitableEventWatcher::Delegate { |
| 54 public: | 54 public: |
| 55 // Map of site to process, to ensure we only have one RenderProcessHost per | |
| 56 // site in process-per-site mode. | |
| 57 typedef base::hash_map<std::string, RenderProcessHost*> SiteProcessMap; | |
| 58 | |
| 59 // Map of BrowserContext to SiteProcessMap, for use in process-per-site mode. | |
| 60 typedef base::hash_map<content::BrowserContext*, SiteProcessMap> | |
| 61 ContextSiteProcessMap; | |
| 62 | |
| 55 RenderProcessHostImpl(BrowserContext* browser_context, bool is_guest); | 63 RenderProcessHostImpl(BrowserContext* browser_context, bool is_guest); |
| 56 virtual ~RenderProcessHostImpl(); | 64 virtual ~RenderProcessHostImpl(); |
| 57 | 65 |
| 58 // RenderProcessHost implementation (public portion). | 66 // RenderProcessHost implementation (public portion). |
| 59 virtual void EnableSendQueue() OVERRIDE; | 67 virtual void EnableSendQueue() OVERRIDE; |
| 60 virtual bool Init() OVERRIDE; | 68 virtual bool Init() OVERRIDE; |
| 61 virtual int GetNextRoutingID() OVERRIDE; | 69 virtual int GetNextRoutingID() OVERRIDE; |
| 62 virtual void CancelResourceRequests(int render_widget_id) OVERRIDE; | 70 virtual void CancelResourceRequests(int render_widget_id) OVERRIDE; |
| 63 virtual void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params) | 71 virtual void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params) |
| 64 OVERRIDE; | 72 OVERRIDE; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 child_process_activity_time_ = base::TimeTicks::Now(); | 125 child_process_activity_time_ = base::TimeTicks::Now(); |
| 118 } | 126 } |
| 119 | 127 |
| 120 // Returns the current number of active views in this process. Excludes | 128 // Returns the current number of active views in this process. Excludes |
| 121 // any RenderViewHosts that are swapped out. | 129 // any RenderViewHosts that are swapped out. |
| 122 int GetActiveViewCount(); | 130 int GetActiveViewCount(); |
| 123 | 131 |
| 124 // Register/unregister the host identified by the host id in the global host | 132 // Register/unregister the host identified by the host id in the global host |
| 125 // list. | 133 // list. |
| 126 static void RegisterHost(int host_id, RenderProcessHost* host); | 134 static void RegisterHost(int host_id, RenderProcessHost* host); |
| 127 static void UnregisterHost(int host_id); | 135 static void UnregisterHost(int host_id, RenderProcessHost* host); |
|
jam
2012/06/28 00:12:52
no need to pass |host| since it can be retrieved f
Charlie Reis
2012/06/28 00:49:15
Good call. Done.
| |
| 128 | 136 |
| 129 // Returns true if the given host is suitable for launching a new view | 137 // Returns true if the given host is suitable for launching a new view |
| 130 // associated with the given browser context. | 138 // associated with the given browser context. |
| 131 static bool IsSuitableHost(RenderProcessHost* host, | 139 static bool IsSuitableHost(RenderProcessHost* host, |
| 132 BrowserContext* browser_context, | 140 BrowserContext* browser_context, |
| 133 const GURL& site_url); | 141 const GURL& site_url); |
| 134 | 142 |
| 135 protected: | 143 protected: |
| 136 // A proxy for our IPC::Channel that lives on the IO thread (see | 144 // A proxy for our IPC::Channel that lives on the IO thread (see |
| 137 // browser_process.h) | 145 // browser_process.h) |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 // Indicates whether this is a RenderProcessHost of a Browser Plugin guest | 278 // Indicates whether this is a RenderProcessHost of a Browser Plugin guest |
| 271 // renderer. | 279 // renderer. |
| 272 bool is_guest_; | 280 bool is_guest_; |
| 273 | 281 |
| 274 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 282 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
| 275 }; | 283 }; |
| 276 | 284 |
| 277 } // namespace content | 285 } // namespace content |
| 278 | 286 |
| 279 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ | 287 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |