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

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

Issue 16431010: Refactor RenderProcessHost to use IPC::Listener instead of RenderWidgetHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing Windows compile error. Created 7 years, 6 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>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 RenderProcessHostImpl(BrowserContext* browser_context, 69 RenderProcessHostImpl(BrowserContext* browser_context,
70 StoragePartitionImpl* storage_partition_impl, 70 StoragePartitionImpl* storage_partition_impl,
71 bool supports_browser_plugin, 71 bool supports_browser_plugin,
72 bool is_guest); 72 bool is_guest);
73 virtual ~RenderProcessHostImpl(); 73 virtual ~RenderProcessHostImpl();
74 74
75 // RenderProcessHost implementation (public portion). 75 // RenderProcessHost implementation (public portion).
76 virtual void EnableSendQueue() OVERRIDE; 76 virtual void EnableSendQueue() OVERRIDE;
77 virtual bool Init() OVERRIDE; 77 virtual bool Init() OVERRIDE;
78 virtual int GetNextRoutingID() OVERRIDE; 78 virtual int GetNextRoutingID() OVERRIDE;
79 virtual void AddRoute(int32 routing_id, IPC::Listener* listener) OVERRIDE;
80 virtual void RemoveRoute(int32 routing_id) OVERRIDE;
79 virtual void SimulateSwapOutACK(const ViewMsg_SwapOut_Params& params) 81 virtual void SimulateSwapOutACK(const ViewMsg_SwapOut_Params& params)
80 OVERRIDE; 82 OVERRIDE;
81 virtual bool WaitForBackingStoreMsg(int render_widget_id, 83 virtual bool WaitForBackingStoreMsg(int render_widget_id,
82 const base::TimeDelta& max_delay, 84 const base::TimeDelta& max_delay,
83 IPC::Message* msg) OVERRIDE; 85 IPC::Message* msg) OVERRIDE;
84 virtual void ReceivedBadMessage() OVERRIDE; 86 virtual void ReceivedBadMessage() OVERRIDE;
85 virtual void WidgetRestored() OVERRIDE; 87 virtual void WidgetRestored() OVERRIDE;
86 virtual void WidgetHidden() OVERRIDE; 88 virtual void WidgetHidden() OVERRIDE;
87 virtual int VisibleWidgetCount() const OVERRIDE; 89 virtual int VisibleWidgetCount() const OVERRIDE;
88 virtual bool IsGuest() const OVERRIDE; 90 virtual bool IsGuest() const OVERRIDE;
89 virtual StoragePartition* GetStoragePartition() const OVERRIDE; 91 virtual StoragePartition* GetStoragePartition() const OVERRIDE;
90 virtual bool FastShutdownIfPossible() OVERRIDE; 92 virtual bool FastShutdownIfPossible() OVERRIDE;
91 virtual void DumpHandles() OVERRIDE; 93 virtual void DumpHandles() OVERRIDE;
92 virtual base::ProcessHandle GetHandle() const OVERRIDE; 94 virtual base::ProcessHandle GetHandle() const OVERRIDE;
93 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id) OVERRIDE; 95 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id) OVERRIDE;
94 virtual TransportDIB* MapTransportDIB(TransportDIB::Id dib_id) OVERRIDE; 96 virtual TransportDIB* MapTransportDIB(TransportDIB::Id dib_id) OVERRIDE;
95 virtual BrowserContext* GetBrowserContext() const OVERRIDE; 97 virtual BrowserContext* GetBrowserContext() const OVERRIDE;
96 virtual bool InSameStoragePartition( 98 virtual bool InSameStoragePartition(
97 StoragePartition* partition) const OVERRIDE; 99 StoragePartition* partition) const OVERRIDE;
98 virtual int GetID() const OVERRIDE; 100 virtual int GetID() const OVERRIDE;
99 virtual bool HasConnection() const OVERRIDE; 101 virtual bool HasConnection() const OVERRIDE;
100 virtual RenderWidgetHost* GetRenderWidgetHostByID(int routing_id)
101 OVERRIDE;
102 virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE; 102 virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE;
103 virtual bool IgnoreInputEvents() const OVERRIDE; 103 virtual bool IgnoreInputEvents() const OVERRIDE;
104 virtual void Attach(RenderWidgetHost* host, int routing_id)
105 OVERRIDE;
106 virtual void Release(int routing_id) OVERRIDE;
107 virtual void Cleanup() OVERRIDE; 104 virtual void Cleanup() OVERRIDE;
108 virtual void AddPendingView() OVERRIDE; 105 virtual void AddPendingView() OVERRIDE;
109 virtual void RemovePendingView() OVERRIDE; 106 virtual void RemovePendingView() OVERRIDE;
110 virtual void SetSuddenTerminationAllowed(bool enabled) OVERRIDE; 107 virtual void SetSuddenTerminationAllowed(bool enabled) OVERRIDE;
111 virtual bool SuddenTerminationAllowed() const OVERRIDE; 108 virtual bool SuddenTerminationAllowed() const OVERRIDE;
112 virtual IPC::ChannelProxy* GetChannel() OVERRIDE; 109 virtual IPC::ChannelProxy* GetChannel() OVERRIDE;
113 virtual RenderWidgetHostsIterator GetRenderWidgetHostsIterator() OVERRIDE;
114 virtual bool FastShutdownForPageCount(size_t count) OVERRIDE; 110 virtual bool FastShutdownForPageCount(size_t count) OVERRIDE;
115 virtual bool FastShutdownStarted() const OVERRIDE; 111 virtual bool FastShutdownStarted() const OVERRIDE;
116 virtual base::TimeDelta GetChildProcessIdleTime() const OVERRIDE; 112 virtual base::TimeDelta GetChildProcessIdleTime() const OVERRIDE;
117 virtual void SurfaceUpdated(int32 surface_id) OVERRIDE; 113 virtual void SurfaceUpdated(int32 surface_id) OVERRIDE;
118 virtual void ResumeRequestsForView(int route_id) OVERRIDE; 114 virtual void ResumeRequestsForView(int route_id) OVERRIDE;
119 115
120 // IPC::Sender via RenderProcessHost. 116 // IPC::Sender via RenderProcessHost.
121 virtual bool Send(IPC::Message* msg) OVERRIDE; 117 virtual bool Send(IPC::Message* msg) OVERRIDE;
122 118
123 // IPC::Listener via RenderProcessHost. 119 // IPC::Listener via RenderProcessHost.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 RenderProcessHost* process, 178 RenderProcessHost* process,
183 const GURL& url); 179 const GURL& url);
184 180
185 static base::MessageLoop* GetInProcessRendererThreadForTesting(); 181 static base::MessageLoop* GetInProcessRendererThreadForTesting();
186 182
187 protected: 183 protected:
188 // A proxy for our IPC::Channel that lives on the IO thread (see 184 // A proxy for our IPC::Channel that lives on the IO thread (see
189 // browser_process.h) 185 // browser_process.h)
190 scoped_ptr<IPC::ChannelProxy> channel_; 186 scoped_ptr<IPC::ChannelProxy> channel_;
191 187
192 // The registered render widget hosts. When this list is empty or all NULL,
193 // we should delete ourselves
194 IDMap<RenderWidgetHost> render_widget_hosts_;
195
196 // True if fast shutdown has been performed on this RPH. 188 // True if fast shutdown has been performed on this RPH.
197 bool fast_shutdown_started_; 189 bool fast_shutdown_started_;
198 190
199 // True if we've posted a DeleteTask and will be deleted soon. 191 // True if we've posted a DeleteTask and will be deleted soon.
200 bool deleting_soon_; 192 bool deleting_soon_;
201 193
202 // The count of currently swapped out but pending RenderViews. We have 194 // The count of currently swapped out but pending RenderViews. We have
203 // started to swap these in, so the renderer process should not exit if 195 // started to swap these in, so the renderer process should not exit if
204 // this count is non-zero. 196 // this count is non-zero.
205 int32 pending_views_; 197 int32 pending_views_;
(...skipping 26 matching lines...) Expand all
232 CommandLine* renderer_cmd) const; 224 CommandLine* renderer_cmd) const;
233 225
234 // Callers can reduce the RenderProcess' priority. 226 // Callers can reduce the RenderProcess' priority.
235 void SetBackgrounded(bool backgrounded); 227 void SetBackgrounded(bool backgrounded);
236 228
237 // Handle termination of our process. 229 // Handle termination of our process.
238 void ProcessDied(bool already_dead); 230 void ProcessDied(bool already_dead);
239 231
240 virtual void OnGpuSwitching() OVERRIDE; 232 virtual void OnGpuSwitching() OVERRIDE;
241 233
234 // The registered IPC listener objects. When this list is empty, we should
235 // delete ourselves.
236 IDMap<IPC::Listener> listeners_;
237
242 // The count of currently visible widgets. Since the host can be a container 238 // The count of currently visible widgets. Since the host can be a container
243 // for multiple widgets, it uses this count to determine when it should be 239 // for multiple widgets, it uses this count to determine when it should be
244 // backgrounded. 240 // backgrounded.
245 int32 visible_widgets_; 241 int32 visible_widgets_;
246 242
247 // Does this process have backgrounded priority. 243 // Does this process have backgrounded priority.
248 bool backgrounded_; 244 bool backgrounded_;
249 245
250 // Used to allow a RenderWidgetHost to intercept various messages on the 246 // Used to allow a RenderWidgetHost to intercept various messages on the
251 // IO thread. 247 // IO thread.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // Prevents the class from being added as a GpuDataManagerImpl observer more 330 // Prevents the class from being added as a GpuDataManagerImpl observer more
335 // than once. 331 // than once.
336 bool gpu_observer_registered_; 332 bool gpu_observer_registered_;
337 333
338 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); 334 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl);
339 }; 335 };
340 336
341 } // namespace content 337 } // namespace content
342 338
343 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ 339 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698