Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.h

Issue 236813002: Move Mojo channel initialization closer to IPC::Channel setup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/process/process.h" 14 #include "base/process/process.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "content/browser/child_process_launcher.h" 16 #include "content/browser/child_process_launcher.h"
17 #include "content/browser/geolocation/geolocation_dispatcher_host.h" 17 #include "content/browser/geolocation/geolocation_dispatcher_host.h"
18 #include "content/browser/power_monitor_message_broadcaster.h" 18 #include "content/browser/power_monitor_message_broadcaster.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "content/common/render_process.mojom.h"
20 #include "content/public/browser/gpu_data_manager_observer.h" 21 #include "content/public/browser/gpu_data_manager_observer.h"
21 #include "content/public/browser/render_process_host.h" 22 #include "content/public/browser/render_process_host.h"
22 #include "ipc/ipc_channel_proxy.h" 23 #include "ipc/ipc_channel_proxy.h"
23 #include "ipc/ipc_platform_file.h" 24 #include "ipc/ipc_platform_file.h"
24 #include "mojo/public/cpp/system/core.h" 25 #include "mojo/embedder/scoped_platform_handle.h"
26 #include "mojo/public/cpp/bindings/remote_ptr.h"
25 #include "ui/surface/transport_dib.h" 27 #include "ui/surface/transport_dib.h"
26 28
27 struct ViewHostMsg_CompositorSurfaceBuffersSwapped_Params; 29 struct ViewHostMsg_CompositorSurfaceBuffersSwapped_Params;
28 30
29 namespace base { 31 namespace base {
30 class CommandLine; 32 class CommandLine;
31 class MessageLoop; 33 class MessageLoop;
32 } 34 }
33 35
34 namespace gfx { 36 namespace gfx {
35 class Size; 37 class Size;
36 } 38 }
37 39
38 namespace content { 40 namespace content {
39 class AudioRendererHost; 41 class AudioRendererHost;
40 class BrowserDemuxerAndroid; 42 class BrowserDemuxerAndroid;
41 class GeolocationDispatcherHost; 43 class GeolocationDispatcherHost;
42 class GpuMessageFilter; 44 class GpuMessageFilter;
43 class MessagePortMessageFilter; 45 class MessagePortMessageFilter;
46 class MojoChannelInit;
44 class PeerConnectionTrackerHost; 47 class PeerConnectionTrackerHost;
45 class RendererMainThread; 48 class RendererMainThread;
46 class RenderProcessHostMojoImpl; 49 class RenderProcessHostMojoImpl;
47 class RenderWidgetHelper; 50 class RenderWidgetHelper;
48 class RenderWidgetHost; 51 class RenderWidgetHost;
49 class RenderWidgetHostImpl; 52 class RenderWidgetHostImpl;
50 class RenderWidgetHostViewFrameSubscriber; 53 class RenderWidgetHostViewFrameSubscriber;
51 class ScreenOrientationDispatcherHost; 54 class ScreenOrientationDispatcherHost;
52 class StoragePartition; 55 class StoragePartition;
53 class StoragePartitionImpl; 56 class StoragePartitionImpl;
(...skipping 11 matching lines...) Expand all
65 // running in the renderer process. Each RenderProcessHost and RenderProcess 68 // running in the renderer process. Each RenderProcessHost and RenderProcess
66 // keeps a list of RenderView (renderer) and WebContentsImpl (browser) which 69 // keeps a list of RenderView (renderer) and WebContentsImpl (browser) which
67 // are correlated with IDs. This way, the Views and the corresponding ViewHosts 70 // are correlated with IDs. This way, the Views and the corresponding ViewHosts
68 // communicate through the two process objects. 71 // communicate through the two process objects.
69 // 72 //
70 // A RenderProcessHost is also associated with one and only one 73 // A RenderProcessHost is also associated with one and only one
71 // StoragePartition. This allows us to implement strong storage isolation 74 // StoragePartition. This allows us to implement strong storage isolation
72 // because all the IPCs from the RenderViews (renderer) will only ever be able 75 // because all the IPCs from the RenderViews (renderer) will only ever be able
73 // to access the partition they are assigned to. 76 // to access the partition they are assigned to.
74 class CONTENT_EXPORT RenderProcessHostImpl 77 class CONTENT_EXPORT RenderProcessHostImpl
75 : public RenderProcessHost, 78 : public IRenderProcessHost,
DaveMoore 2014/04/16 23:08:36 Using IRenderProcessHost makes this read really po
79 public RenderProcessHost,
76 public ChildProcessLauncher::Client, 80 public ChildProcessLauncher::Client,
77 public GpuDataManagerObserver { 81 public GpuDataManagerObserver {
78 public: 82 public:
79 RenderProcessHostImpl(BrowserContext* browser_context, 83 RenderProcessHostImpl(BrowserContext* browser_context,
80 StoragePartitionImpl* storage_partition_impl, 84 StoragePartitionImpl* storage_partition_impl,
81 bool supports_browser_plugin, 85 bool supports_browser_plugin,
82 bool is_guest); 86 bool is_guest);
83 virtual ~RenderProcessHostImpl(); 87 virtual ~RenderProcessHostImpl();
84 88
85 // RenderProcessHost implementation (public portion). 89 // RenderProcessHost implementation (public portion).
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 #endif 259 #endif
256 260
257 // The count of currently swapped out but pending RenderViews. We have 261 // The count of currently swapped out but pending RenderViews. We have
258 // started to swap these in, so the renderer process should not exit if 262 // started to swap these in, so the renderer process should not exit if
259 // this count is non-zero. 263 // this count is non-zero.
260 int32 pending_views_; 264 int32 pending_views_;
261 265
262 private: 266 private:
263 friend class VisitRelayingRenderProcessHost; 267 friend class VisitRelayingRenderProcessHost;
264 268
269 void InitializeMojo();
270 void ActivateMojo();
271
265 // Creates and adds the IO thread message filters. 272 // Creates and adds the IO thread message filters.
266 void CreateMessageFilters(); 273 void CreateMessageFilters();
267 274
268 // Control message handlers. 275 // Control message handlers.
269 void OnShutdownRequest(); 276 void OnShutdownRequest();
270 void OnDumpHandlesDone(); 277 void OnDumpHandlesDone();
271 void SuddenTerminationChanged(bool enabled); 278 void SuddenTerminationChanged(bool enabled);
272 void OnUserMetricsRecordAction(const std::string& action); 279 void OnUserMetricsRecordAction(const std::string& action);
273 void OnSavedPageAsMHTML(int job_id, int64 mhtml_file_size); 280 void OnSavedPageAsMHTML(int job_id, int64 mhtml_file_size);
274 281
(...skipping 19 matching lines...) Expand all
294 void ProcessDied(bool already_dead); 301 void ProcessDied(bool already_dead);
295 302
296 virtual void OnGpuSwitching() OVERRIDE; 303 virtual void OnGpuSwitching() OVERRIDE;
297 304
298 #if defined(ENABLE_WEBRTC) 305 #if defined(ENABLE_WEBRTC)
299 // Sends |file_for_transit| to the render process. 306 // Sends |file_for_transit| to the render process.
300 void SendAecDumpFileToRenderer(IPC::PlatformFileForTransit file_for_transit); 307 void SendAecDumpFileToRenderer(IPC::PlatformFileForTransit file_for_transit);
301 void SendDisableAecDumpToRenderer(); 308 void SendDisableAecDumpToRenderer();
302 #endif 309 #endif
303 310
311 scoped_ptr<MojoChannelInit> mojo_channel_init_;
312 mojo::embedder::ScopedPlatformHandle mojo_client_handle_;
313 mojo::RemotePtr<IRenderProcess> render_process_;
314
304 // The registered IPC listener objects. When this list is empty, we should 315 // The registered IPC listener objects. When this list is empty, we should
305 // delete ourselves. 316 // delete ourselves.
306 IDMap<IPC::Listener> listeners_; 317 IDMap<IPC::Listener> listeners_;
307 318
308 // The count of currently visible widgets. Since the host can be a container 319 // The count of currently visible widgets. Since the host can be a container
309 // for multiple widgets, it uses this count to determine when it should be 320 // for multiple widgets, it uses this count to determine when it should be
310 // backgrounded. 321 // backgrounded.
311 int32 visible_widgets_; 322 int32 visible_widgets_;
312 323
313 // Does this process have backgrounded priority. 324 // Does this process have backgrounded priority.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 #endif 434 #endif
424 435
425 // Message filter and dispatcher for screen orientation. 436 // Message filter and dispatcher for screen orientation.
426 ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host_; 437 ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host_;
427 438
428 int worker_ref_count_; 439 int worker_ref_count_;
429 440
430 // Records the time when the process starts surviving for workers for UMA. 441 // Records the time when the process starts surviving for workers for UMA.
431 base::TimeTicks survive_for_worker_start_time_; 442 base::TimeTicks survive_for_worker_start_time_;
432 443
433 scoped_ptr<RenderProcessHostMojoImpl> render_process_host_mojo_;
434
435 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; 444 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_;
436 445
437 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); 446 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl);
438 }; 447 };
439 448
440 } // namespace content 449 } // namespace content
441 450
442 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ 451 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698