| 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/process.h" | 13 #include "base/process.h" |
| 14 #include "base/timer.h" | 14 #include "base/timer.h" |
| 15 #include "content/browser/child_process_launcher.h" | 15 #include "content/browser/child_process_launcher.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
| 18 #include "ipc/ipc_channel_proxy.h" | 18 #include "ipc/ipc_channel_proxy.h" |
| 19 #include "ui/surface/transport_dib.h" | 19 #include "ui/surface/transport_dib.h" |
| 20 | 20 |
| 21 class CommandLine; | 21 class CommandLine; |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class GpuMessageFilter; | 24 class GpuMessageFilter; |
| 25 class RendererMainThread; | 25 class RendererMainThread; |
| 26 class RenderWidgetHelper; | 26 class RenderWidgetHelper; |
| 27 class RenderWidgetHost; | 27 class RenderWidgetHost; |
| 28 class RenderWidgetHostImpl; | 28 class RenderWidgetHostImpl; |
| 29 class StoragePartitionImpl; |
| 29 | 30 |
| 30 // Implements a concrete RenderProcessHost for the browser process for talking | 31 // Implements a concrete RenderProcessHost for the browser process for talking |
| 31 // to actual renderer processes (as opposed to mocks). | 32 // to actual renderer processes (as opposed to mocks). |
| 32 // | 33 // |
| 33 // Represents the browser side of the browser <--> renderer communication | 34 // Represents the browser side of the browser <--> renderer communication |
| 34 // channel. There will be one RenderProcessHost per renderer process. | 35 // channel. There will be one RenderProcessHost per renderer process. |
| 35 // | 36 // |
| 36 // This object is refcounted so that it can release its resources when all | 37 // This object is refcounted so that it can release its resources when all |
| 37 // hosts using it go away. | 38 // hosts using it go away. |
| 38 // | 39 // |
| 39 // This object communicates back and forth with the RenderProcess object | 40 // This object communicates back and forth with the RenderProcess object |
| 40 // running in the renderer process. Each RenderProcessHost and RenderProcess | 41 // running in the renderer process. Each RenderProcessHost and RenderProcess |
| 41 // keeps a list of RenderView (renderer) and WebContentsImpl (browser) which | 42 // keeps a list of RenderView (renderer) and WebContentsImpl (browser) which |
| 42 // are correlated with IDs. This way, the Views and the corresponding ViewHosts | 43 // are correlated with IDs. This way, the Views and the corresponding ViewHosts |
| 43 // communicate through the two process objects. | 44 // communicate through the two process objects. |
| 45 // |
| 46 // A RenderProcessHost is also associated with one and only one |
| 47 // StoragePartition. This allows us to implement strong storage isolation |
| 48 // because all the IPCs from the RenderViews (renderer) will only ever be able |
| 49 // to access the partition they are assigned to. |
| 44 class CONTENT_EXPORT RenderProcessHostImpl | 50 class CONTENT_EXPORT RenderProcessHostImpl |
| 45 : public RenderProcessHost, | 51 : public RenderProcessHost, |
| 46 public ChildProcessLauncher::Client { | 52 public ChildProcessLauncher::Client { |
| 47 public: | 53 public: |
| 48 RenderProcessHostImpl(BrowserContext* browser_context, bool is_guest); | 54 RenderProcessHostImpl(BrowserContext* browser_context, |
| 55 StoragePartitionImpl* storage_partition_impl, |
| 56 bool is_guest); |
| 49 virtual ~RenderProcessHostImpl(); | 57 virtual ~RenderProcessHostImpl(); |
| 50 | 58 |
| 51 // RenderProcessHost implementation (public portion). | 59 // RenderProcessHost implementation (public portion). |
| 52 virtual void EnableSendQueue() OVERRIDE; | 60 virtual void EnableSendQueue() OVERRIDE; |
| 53 virtual bool Init() OVERRIDE; | 61 virtual bool Init() OVERRIDE; |
| 54 virtual int GetNextRoutingID() OVERRIDE; | 62 virtual int GetNextRoutingID() OVERRIDE; |
| 55 virtual void CancelResourceRequests(int render_widget_id) OVERRIDE; | 63 virtual void CancelResourceRequests(int render_widget_id) OVERRIDE; |
| 56 virtual void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params) | 64 virtual void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params) |
| 57 OVERRIDE; | 65 OVERRIDE; |
| 58 virtual bool WaitForBackingStoreMsg(int render_widget_id, | 66 virtual bool WaitForBackingStoreMsg(int render_widget_id, |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // instead of in the channel so that we ensure they're sent after init related | 260 // instead of in the channel so that we ensure they're sent after init related |
| 253 // messages that are sent once the process handle is available. This is | 261 // messages that are sent once the process handle is available. This is |
| 254 // because the queued messages may have dependencies on the init messages. | 262 // because the queued messages may have dependencies on the init messages. |
| 255 std::queue<IPC::Message*> queued_messages_; | 263 std::queue<IPC::Message*> queued_messages_; |
| 256 | 264 |
| 257 // The globally-unique identifier for this RPH. | 265 // The globally-unique identifier for this RPH. |
| 258 int id_; | 266 int id_; |
| 259 | 267 |
| 260 BrowserContext* browser_context_; | 268 BrowserContext* browser_context_; |
| 261 | 269 |
| 270 // Owned by |browser_context_|. |
| 271 StoragePartitionImpl* storage_partition_impl_; |
| 272 |
| 262 // True if the process can be shut down suddenly. If this is true, then we're | 273 // True if the process can be shut down suddenly. If this is true, then we're |
| 263 // sure that all the RenderViews in the process can be shutdown suddenly. If | 274 // sure that all the RenderViews in the process can be shutdown suddenly. If |
| 264 // it's false, then specific RenderViews might still be allowed to be shutdown | 275 // it's false, then specific RenderViews might still be allowed to be shutdown |
| 265 // suddenly by checking their SuddenTerminationAllowed() flag. This can occur | 276 // suddenly by checking their SuddenTerminationAllowed() flag. This can occur |
| 266 // if one WebContents has an unload event listener but another WebContents in | 277 // if one WebContents has an unload event listener but another WebContents in |
| 267 // the same process doesn't. | 278 // the same process doesn't. |
| 268 bool sudden_termination_allowed_; | 279 bool sudden_termination_allowed_; |
| 269 | 280 |
| 270 // Set to true if we shouldn't send input events. We actually do the | 281 // Set to true if we shouldn't send input events. We actually do the |
| 271 // filtering for this at the render widget level. | 282 // filtering for this at the render widget level. |
| 272 bool ignore_input_events_; | 283 bool ignore_input_events_; |
| 273 | 284 |
| 274 // Records the last time we regarded the child process active. | 285 // Records the last time we regarded the child process active. |
| 275 base::TimeTicks child_process_activity_time_; | 286 base::TimeTicks child_process_activity_time_; |
| 276 | 287 |
| 277 // Indicates whether this is a RenderProcessHost of a Browser Plugin guest | 288 // Indicates whether this is a RenderProcessHost of a Browser Plugin guest |
| 278 // renderer. | 289 // renderer. |
| 279 bool is_guest_; | 290 bool is_guest_; |
| 280 | 291 |
| 281 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 292 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
| 282 }; | 293 }; |
| 283 | 294 |
| 284 } // namespace content | 295 } // namespace content |
| 285 | 296 |
| 286 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ | 297 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |