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

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: fixes 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 // True if the callback for the destruction of this object has been fired.
211 bool deletion_callback_called_;
212
207 // The count of currently swapped out but pending RenderViews. We have 213 // 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 214 // started to swap these in, so the renderer process should not exit if
209 // this count is non-zero. 215 // this count is non-zero.
210 int32 pending_views_; 216 int32 pending_views_;
211 217
212 private: 218 private:
213 friend class VisitRelayingRenderProcessHost; 219 friend class VisitRelayingRenderProcessHost;
214 220
215 // Creates and adds the IO thread message filters. 221 // Creates and adds the IO thread message filters.
216 void CreateMessageFilters(); 222 void CreateMessageFilters();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 std::queue<IPC::Message*> queued_messages_; 306 std::queue<IPC::Message*> queued_messages_;
301 307
302 // The globally-unique identifier for this RPH. 308 // The globally-unique identifier for this RPH.
303 int id_; 309 int id_;
304 310
305 BrowserContext* browser_context_; 311 BrowserContext* browser_context_;
306 312
307 // Owned by |browser_context_|. 313 // Owned by |browser_context_|.
308 StoragePartitionImpl* storage_partition_impl_; 314 StoragePartitionImpl* storage_partition_impl_;
309 315
316 // The observers watching our lifetime.
317 ObserverList<RenderProcessHostObserver> observers_;
318
310 // True if the process can be shut down suddenly. If this is true, then we're 319 // 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 320 // 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 321 // it's false, then specific RenderViews might still be allowed to be shutdown
313 // suddenly by checking their SuddenTerminationAllowed() flag. This can occur 322 // suddenly by checking their SuddenTerminationAllowed() flag. This can occur
314 // if one WebContents has an unload event listener but another WebContents in 323 // if one WebContents has an unload event listener but another WebContents in
315 // the same process doesn't. 324 // the same process doesn't.
316 bool sudden_termination_allowed_; 325 bool sudden_termination_allowed_;
317 326
318 // Set to true if we shouldn't send input events. We actually do the 327 // Set to true if we shouldn't send input events. We actually do the
319 // filtering for this at the render widget level. 328 // filtering for this at the render widget level.
(...skipping 26 matching lines...) Expand all
346 #if defined(OS_ANDROID) 355 #if defined(OS_ANDROID)
347 scoped_refptr<BrowserDemuxerAndroid> browser_demuxer_android_; 356 scoped_refptr<BrowserDemuxerAndroid> browser_demuxer_android_;
348 #endif 357 #endif
349 358
350 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); 359 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl);
351 }; 360 };
352 361
353 } // namespace content 362 } // namespace content
354 363
355 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ 364 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698