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

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: fixup 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
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"
27 #include "mojo/public/interfaces/shell/shell.mojom.h"
25 #include "ui/surface/transport_dib.h" 28 #include "ui/surface/transport_dib.h"
26 29
27 struct ViewHostMsg_CompositorSurfaceBuffersSwapped_Params; 30 struct ViewHostMsg_CompositorSurfaceBuffersSwapped_Params;
28 31
29 namespace base { 32 namespace base {
30 class CommandLine; 33 class CommandLine;
31 class MessageLoop; 34 class MessageLoop;
32 } 35 }
33 36
34 namespace gfx { 37 namespace gfx {
35 class Size; 38 class Size;
36 } 39 }
37 40
38 namespace content { 41 namespace content {
39 class AudioRendererHost; 42 class AudioRendererHost;
40 class BrowserDemuxerAndroid; 43 class BrowserDemuxerAndroid;
41 class GeolocationDispatcherHost; 44 class GeolocationDispatcherHost;
42 class GpuMessageFilter; 45 class GpuMessageFilter;
43 class MessagePortMessageFilter; 46 class MessagePortMessageFilter;
47 class MojoApplicationHost;
44 class PeerConnectionTrackerHost; 48 class PeerConnectionTrackerHost;
45 class RendererMainThread; 49 class RendererMainThread;
46 class RenderProcessHostMojoImpl; 50 class RenderProcessHostMojoImpl;
47 class RenderWidgetHelper; 51 class RenderWidgetHelper;
48 class RenderWidgetHost; 52 class RenderWidgetHost;
49 class RenderWidgetHostImpl; 53 class RenderWidgetHostImpl;
50 class RenderWidgetHostViewFrameSubscriber; 54 class RenderWidgetHostViewFrameSubscriber;
51 class ScreenOrientationDispatcherHost; 55 class ScreenOrientationDispatcherHost;
52 class StoragePartition; 56 class StoragePartition;
53 class StoragePartitionImpl; 57 class StoragePartitionImpl;
(...skipping 10 matching lines...) Expand all
64 // This object communicates back and forth with the RenderProcess object 68 // This object communicates back and forth with the RenderProcess object
65 // running in the renderer process. Each RenderProcessHost and RenderProcess 69 // running in the renderer process. Each RenderProcessHost and RenderProcess
66 // keeps a list of RenderView (renderer) and WebContentsImpl (browser) which 70 // keeps a list of RenderView (renderer) and WebContentsImpl (browser) which
67 // are correlated with IDs. This way, the Views and the corresponding ViewHosts 71 // are correlated with IDs. This way, the Views and the corresponding ViewHosts
68 // communicate through the two process objects. 72 // communicate through the two process objects.
69 // 73 //
70 // A RenderProcessHost is also associated with one and only one 74 // A RenderProcessHost is also associated with one and only one
71 // StoragePartition. This allows us to implement strong storage isolation 75 // StoragePartition. This allows us to implement strong storage isolation
72 // because all the IPCs from the RenderViews (renderer) will only ever be able 76 // because all the IPCs from the RenderViews (renderer) will only ever be able
73 // to access the partition they are assigned to. 77 // to access the partition they are assigned to.
74 class CONTENT_EXPORT RenderProcessHostImpl 78 class CONTENT_EXPORT RenderProcessHostImpl
DaveMoore 2014/04/16 23:08:36 This seems bad. You have FooImpl, IFoo and Foo all
darin (slow to review) 2014/04/16 23:26:04 Yeah, I wanted to see what this would feel like. D
DaveMoore 2014/04/17 17:56:09 So what will determine what's in the new interface
koz (OOO until 15th September) 2014/04/22 07:09:59 It's true that the mojo interfaces are just regula
75 : public RenderProcessHost, 79 : public IRenderProcessHost,
80 public RenderProcessHost,
76 public ChildProcessLauncher::Client, 81 public ChildProcessLauncher::Client,
77 public GpuDataManagerObserver { 82 public GpuDataManagerObserver {
78 public: 83 public:
79 RenderProcessHostImpl(BrowserContext* browser_context, 84 RenderProcessHostImpl(BrowserContext* browser_context,
80 StoragePartitionImpl* storage_partition_impl, 85 StoragePartitionImpl* storage_partition_impl,
81 bool supports_browser_plugin, 86 bool supports_browser_plugin,
82 bool is_guest); 87 bool is_guest);
83 virtual ~RenderProcessHostImpl(); 88 virtual ~RenderProcessHostImpl();
84 89
85 // RenderProcessHost implementation (public portion). 90 // RenderProcessHost implementation (public portion).
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 #endif 260 #endif
256 261
257 // The count of currently swapped out but pending RenderViews. We have 262 // 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 263 // started to swap these in, so the renderer process should not exit if
259 // this count is non-zero. 264 // this count is non-zero.
260 int32 pending_views_; 265 int32 pending_views_;
261 266
262 private: 267 private:
263 friend class VisitRelayingRenderProcessHost; 268 friend class VisitRelayingRenderProcessHost;
264 269
270 void InitializeMojo();
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<MojoApplicationHost> mojo_application_host_;
312 mojo::RemotePtr<IRenderProcess> render_process_;
313
304 // The registered IPC listener objects. When this list is empty, we should 314 // The registered IPC listener objects. When this list is empty, we should
305 // delete ourselves. 315 // delete ourselves.
306 IDMap<IPC::Listener> listeners_; 316 IDMap<IPC::Listener> listeners_;
307 317
308 // The count of currently visible widgets. Since the host can be a container 318 // 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 319 // for multiple widgets, it uses this count to determine when it should be
310 // backgrounded. 320 // backgrounded.
311 int32 visible_widgets_; 321 int32 visible_widgets_;
312 322
313 // Does this process have backgrounded priority. 323 // Does this process have backgrounded priority.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 #endif 433 #endif
424 434
425 // Message filter and dispatcher for screen orientation. 435 // Message filter and dispatcher for screen orientation.
426 ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host_; 436 ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host_;
427 437
428 int worker_ref_count_; 438 int worker_ref_count_;
429 439
430 // Records the time when the process starts surviving for workers for UMA. 440 // Records the time when the process starts surviving for workers for UMA.
431 base::TimeTicks survive_for_worker_start_time_; 441 base::TimeTicks survive_for_worker_start_time_;
432 442
433 scoped_ptr<RenderProcessHostMojoImpl> render_process_host_mojo_;
434
435 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; 443 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_;
436 444
437 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); 445 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl);
438 }; 446 };
439 447
440 } // namespace content 448 } // namespace content
441 449
442 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ 450 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698