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

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

Issue 72203003: Introduce RenderProcessHostObserver, use it in its first client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: release mode Created 7 years, 1 month 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/process/process.h" 14 #include "base/process/process.h"
14 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
15 #include "content/browser/child_process_launcher.h" 16 #include "content/browser/child_process_launcher.h"
16 #include "content/browser/power_monitor_message_broadcaster.h" 17 #include "content/browser/power_monitor_message_broadcaster.h"
17 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
18 #include "content/public/browser/global_request_id.h" 19 #include "content/public/browser/global_request_id.h"
19 #include "content/public/browser/gpu_data_manager_observer.h" 20 #include "content/public/browser/gpu_data_manager_observer.h"
20 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
21 #include "ipc/ipc_channel_proxy.h" 22 #include "ipc/ipc_channel_proxy.h"
22 #include "ui/surface/transport_dib.h" 23 #include "ui/surface/transport_dib.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 bool supports_browser_plugin, 76 bool supports_browser_plugin,
76 bool is_guest); 77 bool is_guest);
77 virtual ~RenderProcessHostImpl(); 78 virtual ~RenderProcessHostImpl();
78 79
79 // RenderProcessHost implementation (public portion). 80 // RenderProcessHost implementation (public portion).
80 virtual void EnableSendQueue() OVERRIDE; 81 virtual void EnableSendQueue() OVERRIDE;
81 virtual bool Init() OVERRIDE; 82 virtual bool Init() OVERRIDE;
82 virtual int GetNextRoutingID() OVERRIDE; 83 virtual int GetNextRoutingID() OVERRIDE;
83 virtual void AddRoute(int32 routing_id, IPC::Listener* listener) OVERRIDE; 84 virtual void AddRoute(int32 routing_id, IPC::Listener* listener) OVERRIDE;
84 virtual void RemoveRoute(int32 routing_id) OVERRIDE; 85 virtual void RemoveRoute(int32 routing_id) OVERRIDE;
86 virtual void AddObserver(RenderProcessHostObserver* observer) OVERRIDE;
87 virtual void RemoveObserver(RenderProcessHostObserver* observer) OVERRIDE;
85 virtual bool WaitForBackingStoreMsg(int render_widget_id, 88 virtual bool WaitForBackingStoreMsg(int render_widget_id,
86 const base::TimeDelta& max_delay, 89 const base::TimeDelta& max_delay,
87 IPC::Message* msg) OVERRIDE; 90 IPC::Message* msg) OVERRIDE;
88 virtual void ReceivedBadMessage() OVERRIDE; 91 virtual void ReceivedBadMessage() OVERRIDE;
89 virtual void WidgetRestored() OVERRIDE; 92 virtual void WidgetRestored() OVERRIDE;
90 virtual void WidgetHidden() OVERRIDE; 93 virtual void WidgetHidden() OVERRIDE;
91 virtual int VisibleWidgetCount() const OVERRIDE; 94 virtual int VisibleWidgetCount() const OVERRIDE;
92 virtual bool IsGuest() const OVERRIDE; 95 virtual bool IsGuest() const OVERRIDE;
93 virtual StoragePartition* GetStoragePartition() const OVERRIDE; 96 virtual StoragePartition* GetStoragePartition() const OVERRIDE;
94 virtual bool FastShutdownIfPossible() OVERRIDE; 97 virtual bool FastShutdownIfPossible() OVERRIDE;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // A proxy for our IPC::Channel that lives on the IO thread (see 200 // A proxy for our IPC::Channel that lives on the IO thread (see
198 // browser_process.h) 201 // browser_process.h)
199 scoped_ptr<IPC::ChannelProxy> channel_; 202 scoped_ptr<IPC::ChannelProxy> channel_;
200 203
201 // True if fast shutdown has been performed on this RPH. 204 // True if fast shutdown has been performed on this RPH.
202 bool fast_shutdown_started_; 205 bool fast_shutdown_started_;
203 206
204 // True if we've posted a DeleteTask and will be deleted soon. 207 // True if we've posted a DeleteTask and will be deleted soon.
205 bool deleting_soon_; 208 bool deleting_soon_;
206 209
210 #ifndef NDEBUG
211 // True if this object has deleted itself.
212 bool is_self_deleted_;
213 #endif
214
207 // The count of currently swapped out but pending RenderViews. We have 215 // The count of currently swapped out but pending RenderViews. We have
208 // started to swap these in, so the renderer process should not exit if 216 // started to swap these in, so the renderer process should not exit if
209 // this count is non-zero. 217 // this count is non-zero.
210 int32 pending_views_; 218 int32 pending_views_;
211 219
212 private: 220 private:
221 friend class RenderProcessHost;
213 friend class VisitRelayingRenderProcessHost; 222 friend class VisitRelayingRenderProcessHost;
214 223
215 // Creates and adds the IO thread message filters. 224 // Creates and adds the IO thread message filters.
216 void CreateMessageFilters(); 225 void CreateMessageFilters();
217 226
218 // Control message handlers. 227 // Control message handlers.
219 void OnShutdownRequest(); 228 void OnShutdownRequest();
220 void OnDumpHandlesDone(); 229 void OnDumpHandlesDone();
221 void SuddenTerminationChanged(bool enabled); 230 void SuddenTerminationChanged(bool enabled);
222 void OnUserMetricsRecordAction(const std::string& action); 231 void OnUserMetricsRecordAction(const std::string& action);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 std::queue<IPC::Message*> queued_messages_; 309 std::queue<IPC::Message*> queued_messages_;
301 310
302 // The globally-unique identifier for this RPH. 311 // The globally-unique identifier for this RPH.
303 int id_; 312 int id_;
304 313
305 BrowserContext* browser_context_; 314 BrowserContext* browser_context_;
306 315
307 // Owned by |browser_context_|. 316 // Owned by |browser_context_|.
308 StoragePartitionImpl* storage_partition_impl_; 317 StoragePartitionImpl* storage_partition_impl_;
309 318
319 // The observers watching our lifetime.
320 ObserverList<RenderProcessHostObserver> observers_;
321
310 // True if the process can be shut down suddenly. If this is true, then we're 322 // True if the process can be shut down suddenly. If this is true, then we're
311 // sure that all the RenderViews in the process can be shutdown suddenly. If 323 // sure that all the RenderViews in the process can be shutdown suddenly. If
312 // it's false, then specific RenderViews might still be allowed to be shutdown 324 // it's false, then specific RenderViews might still be allowed to be shutdown
313 // suddenly by checking their SuddenTerminationAllowed() flag. This can occur 325 // suddenly by checking their SuddenTerminationAllowed() flag. This can occur
314 // if one WebContents has an unload event listener but another WebContents in 326 // if one WebContents has an unload event listener but another WebContents in
315 // the same process doesn't. 327 // the same process doesn't.
316 bool sudden_termination_allowed_; 328 bool sudden_termination_allowed_;
317 329
318 // Set to true if we shouldn't send input events. We actually do the 330 // Set to true if we shouldn't send input events. We actually do the
319 // filtering for this at the render widget level. 331 // filtering for this at the render widget level.
(...skipping 26 matching lines...) Expand all
346 #if defined(OS_ANDROID) 358 #if defined(OS_ANDROID)
347 scoped_refptr<BrowserDemuxerAndroid> browser_demuxer_android_; 359 scoped_refptr<BrowserDemuxerAndroid> browser_demuxer_android_;
348 #endif 360 #endif
349 361
350 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); 362 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl);
351 }; 363 };
352 364
353 } // namespace content 365 } // namespace content
354 366
355 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ 367 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698