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

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: Rebase on top of hash_pair move. 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 bool WaitForBackingStoreMsg(int render_widget_id, 81 virtual bool WaitForBackingStoreMsg(int render_widget_id,
80 const base::TimeDelta& max_delay, 82 const base::TimeDelta& max_delay,
81 IPC::Message* msg) OVERRIDE; 83 IPC::Message* msg) OVERRIDE;
82 virtual void ReceivedBadMessage() OVERRIDE; 84 virtual void ReceivedBadMessage() OVERRIDE;
83 virtual void WidgetRestored() OVERRIDE; 85 virtual void WidgetRestored() OVERRIDE;
84 virtual void WidgetHidden() OVERRIDE; 86 virtual void WidgetHidden() OVERRIDE;
85 virtual int VisibleWidgetCount() const OVERRIDE; 87 virtual int VisibleWidgetCount() const OVERRIDE;
86 virtual bool IsGuest() const OVERRIDE; 88 virtual bool IsGuest() const OVERRIDE;
87 virtual StoragePartition* GetStoragePartition() const OVERRIDE; 89 virtual StoragePartition* GetStoragePartition() const OVERRIDE;
88 virtual bool FastShutdownIfPossible() OVERRIDE; 90 virtual bool FastShutdownIfPossible() OVERRIDE;
89 virtual void DumpHandles() OVERRIDE; 91 virtual void DumpHandles() OVERRIDE;
90 virtual base::ProcessHandle GetHandle() const OVERRIDE; 92 virtual base::ProcessHandle GetHandle() const OVERRIDE;
91 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id) OVERRIDE; 93 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id) OVERRIDE;
92 virtual TransportDIB* MapTransportDIB(TransportDIB::Id dib_id) OVERRIDE; 94 virtual TransportDIB* MapTransportDIB(TransportDIB::Id dib_id) OVERRIDE;
93 virtual BrowserContext* GetBrowserContext() const OVERRIDE; 95 virtual BrowserContext* GetBrowserContext() const OVERRIDE;
94 virtual bool InSameStoragePartition( 96 virtual bool InSameStoragePartition(
95 StoragePartition* partition) const OVERRIDE; 97 StoragePartition* partition) const OVERRIDE;
96 virtual int GetID() const OVERRIDE; 98 virtual int GetID() const OVERRIDE;
97 virtual bool HasConnection() const OVERRIDE; 99 virtual bool HasConnection() const OVERRIDE;
98 virtual RenderWidgetHost* GetRenderWidgetHostByID(int routing_id)
99 OVERRIDE;
100 virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE; 100 virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE;
101 virtual bool IgnoreInputEvents() const OVERRIDE; 101 virtual bool IgnoreInputEvents() const OVERRIDE;
102 virtual void Attach(RenderWidgetHost* host, int routing_id)
103 OVERRIDE;
104 virtual void Release(int routing_id) OVERRIDE;
105 virtual void Cleanup() OVERRIDE; 102 virtual void Cleanup() OVERRIDE;
106 virtual void AddPendingView() OVERRIDE; 103 virtual void AddPendingView() OVERRIDE;
107 virtual void RemovePendingView() OVERRIDE; 104 virtual void RemovePendingView() OVERRIDE;
108 virtual void SetSuddenTerminationAllowed(bool enabled) OVERRIDE; 105 virtual void SetSuddenTerminationAllowed(bool enabled) OVERRIDE;
109 virtual bool SuddenTerminationAllowed() const OVERRIDE; 106 virtual bool SuddenTerminationAllowed() const OVERRIDE;
110 virtual IPC::ChannelProxy* GetChannel() OVERRIDE; 107 virtual IPC::ChannelProxy* GetChannel() OVERRIDE;
111 virtual RenderWidgetHostsIterator GetRenderWidgetHostsIterator() OVERRIDE;
112 virtual bool FastShutdownForPageCount(size_t count) OVERRIDE; 108 virtual bool FastShutdownForPageCount(size_t count) OVERRIDE;
113 virtual bool FastShutdownStarted() const OVERRIDE; 109 virtual bool FastShutdownStarted() const OVERRIDE;
114 virtual base::TimeDelta GetChildProcessIdleTime() const OVERRIDE; 110 virtual base::TimeDelta GetChildProcessIdleTime() const OVERRIDE;
115 virtual void SurfaceUpdated(int32 surface_id) OVERRIDE; 111 virtual void SurfaceUpdated(int32 surface_id) OVERRIDE;
116 virtual void ResumeRequestsForView(int route_id) OVERRIDE; 112 virtual void ResumeRequestsForView(int route_id) OVERRIDE;
117 113
118 // IPC::Sender via RenderProcessHost. 114 // IPC::Sender via RenderProcessHost.
119 virtual bool Send(IPC::Message* msg) OVERRIDE; 115 virtual bool Send(IPC::Message* msg) OVERRIDE;
120 116
121 // IPC::Listener via RenderProcessHost. 117 // IPC::Listener via RenderProcessHost.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 RenderProcessHost* process, 174 RenderProcessHost* process,
179 const GURL& url); 175 const GURL& url);
180 176
181 static base::MessageLoop* GetInProcessRendererThreadForTesting(); 177 static base::MessageLoop* GetInProcessRendererThreadForTesting();
182 178
183 protected: 179 protected:
184 // A proxy for our IPC::Channel that lives on the IO thread (see 180 // A proxy for our IPC::Channel that lives on the IO thread (see
185 // browser_process.h) 181 // browser_process.h)
186 scoped_ptr<IPC::ChannelProxy> channel_; 182 scoped_ptr<IPC::ChannelProxy> channel_;
187 183
188 // The registered render widget hosts. When this list is empty or all NULL,
189 // we should delete ourselves
190 IDMap<RenderWidgetHost> render_widget_hosts_;
191
192 // True if fast shutdown has been performed on this RPH. 184 // True if fast shutdown has been performed on this RPH.
193 bool fast_shutdown_started_; 185 bool fast_shutdown_started_;
194 186
195 // True if we've posted a DeleteTask and will be deleted soon. 187 // True if we've posted a DeleteTask and will be deleted soon.
196 bool deleting_soon_; 188 bool deleting_soon_;
197 189
198 // The count of currently swapped out but pending RenderViews. We have 190 // The count of currently swapped out but pending RenderViews. We have
199 // started to swap these in, so the renderer process should not exit if 191 // started to swap these in, so the renderer process should not exit if
200 // this count is non-zero. 192 // this count is non-zero.
201 int32 pending_views_; 193 int32 pending_views_;
(...skipping 26 matching lines...) Expand all
228 CommandLine* renderer_cmd) const; 220 CommandLine* renderer_cmd) const;
229 221
230 // Callers can reduce the RenderProcess' priority. 222 // Callers can reduce the RenderProcess' priority.
231 void SetBackgrounded(bool backgrounded); 223 void SetBackgrounded(bool backgrounded);
232 224
233 // Handle termination of our process. 225 // Handle termination of our process.
234 void ProcessDied(bool already_dead); 226 void ProcessDied(bool already_dead);
235 227
236 virtual void OnGpuSwitching() OVERRIDE; 228 virtual void OnGpuSwitching() OVERRIDE;
237 229
230 // The registered IPC listener objects. When this list is empty, we should
231 // delete ourselves.
232 IDMap<IPC::Listener> listeners_;
233
238 // The count of currently visible widgets. Since the host can be a container 234 // The count of currently visible widgets. Since the host can be a container
239 // for multiple widgets, it uses this count to determine when it should be 235 // for multiple widgets, it uses this count to determine when it should be
240 // backgrounded. 236 // backgrounded.
241 int32 visible_widgets_; 237 int32 visible_widgets_;
242 238
243 // Does this process have backgrounded priority. 239 // Does this process have backgrounded priority.
244 bool backgrounded_; 240 bool backgrounded_;
245 241
246 // Used to allow a RenderWidgetHost to intercept various messages on the 242 // Used to allow a RenderWidgetHost to intercept various messages on the
247 // IO thread. 243 // IO thread.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // Prevents the class from being added as a GpuDataManagerImpl observer more 317 // Prevents the class from being added as a GpuDataManagerImpl observer more
322 // than once. 318 // than once.
323 bool gpu_observer_registered_; 319 bool gpu_observer_registered_;
324 320
325 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); 321 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl);
326 }; 322 };
327 323
328 } // namespace content 324 } // namespace content
329 325
330 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ 326 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698