OLD | NEW |
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 Loading... |
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // This should only be used for process-per-site mode, which can be enabled | 179 // This should only be used for process-per-site mode, which can be enabled |
177 // globally with a command line flag or per-site, as determined by | 180 // globally with a command line flag or per-site, as determined by |
178 // SiteInstanceImpl::ShouldUseProcessPerSite. | 181 // SiteInstanceImpl::ShouldUseProcessPerSite. |
179 static void RegisterProcessHostForSite( | 182 static void RegisterProcessHostForSite( |
180 BrowserContext* browser_context, | 183 BrowserContext* browser_context, |
181 RenderProcessHost* process, | 184 RenderProcessHost* process, |
182 const GURL& url); | 185 const GURL& url); |
183 | 186 |
184 static base::MessageLoop* GetInProcessRendererThreadForTesting(); | 187 static base::MessageLoop* GetInProcessRendererThreadForTesting(); |
185 | 188 |
| 189 // This forces a renderer that is running "in process" to shut down. |
| 190 static void ShutDownInProcessRenderer(); |
| 191 |
186 #if defined(OS_ANDROID) | 192 #if defined(OS_ANDROID) |
187 const scoped_refptr<BrowserDemuxerAndroid>& browser_demuxer_android() { | 193 const scoped_refptr<BrowserDemuxerAndroid>& browser_demuxer_android() { |
188 return browser_demuxer_android_; | 194 return browser_demuxer_android_; |
189 } | 195 } |
190 #endif | 196 #endif |
191 | 197 |
192 MessagePortMessageFilter* message_port_message_filter() const { | 198 MessagePortMessageFilter* message_port_message_filter() const { |
193 return message_port_message_filter_; | 199 return message_port_message_filter_; |
194 } | 200 } |
195 | 201 |
196 protected: | 202 protected: |
197 // A proxy for our IPC::Channel that lives on the IO thread (see | 203 // A proxy for our IPC::Channel that lives on the IO thread (see |
198 // browser_process.h) | 204 // browser_process.h) |
199 scoped_ptr<IPC::ChannelProxy> channel_; | 205 scoped_ptr<IPC::ChannelProxy> channel_; |
200 | 206 |
201 // True if fast shutdown has been performed on this RPH. | 207 // True if fast shutdown has been performed on this RPH. |
202 bool fast_shutdown_started_; | 208 bool fast_shutdown_started_; |
203 | 209 |
204 // True if we've posted a DeleteTask and will be deleted soon. | 210 // True if we've posted a DeleteTask and will be deleted soon. |
205 bool deleting_soon_; | 211 bool deleting_soon_; |
206 | 212 |
| 213 #ifndef NDEBUG |
| 214 // True if this object has deleted itself. |
| 215 bool is_self_deleted_; |
| 216 #endif |
| 217 |
207 // The count of currently swapped out but pending RenderViews. We have | 218 // 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 | 219 // started to swap these in, so the renderer process should not exit if |
209 // this count is non-zero. | 220 // this count is non-zero. |
210 int32 pending_views_; | 221 int32 pending_views_; |
211 | 222 |
212 private: | 223 private: |
213 friend class VisitRelayingRenderProcessHost; | 224 friend class VisitRelayingRenderProcessHost; |
214 | 225 |
215 // Creates and adds the IO thread message filters. | 226 // Creates and adds the IO thread message filters. |
216 void CreateMessageFilters(); | 227 void CreateMessageFilters(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 std::queue<IPC::Message*> queued_messages_; | 311 std::queue<IPC::Message*> queued_messages_; |
301 | 312 |
302 // The globally-unique identifier for this RPH. | 313 // The globally-unique identifier for this RPH. |
303 int id_; | 314 int id_; |
304 | 315 |
305 BrowserContext* browser_context_; | 316 BrowserContext* browser_context_; |
306 | 317 |
307 // Owned by |browser_context_|. | 318 // Owned by |browser_context_|. |
308 StoragePartitionImpl* storage_partition_impl_; | 319 StoragePartitionImpl* storage_partition_impl_; |
309 | 320 |
| 321 // The observers watching our lifetime. |
| 322 ObserverList<RenderProcessHostObserver> observers_; |
| 323 |
310 // True if the process can be shut down suddenly. If this is true, then we're | 324 // 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 | 325 // 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 | 326 // it's false, then specific RenderViews might still be allowed to be shutdown |
313 // suddenly by checking their SuddenTerminationAllowed() flag. This can occur | 327 // suddenly by checking their SuddenTerminationAllowed() flag. This can occur |
314 // if one WebContents has an unload event listener but another WebContents in | 328 // if one WebContents has an unload event listener but another WebContents in |
315 // the same process doesn't. | 329 // the same process doesn't. |
316 bool sudden_termination_allowed_; | 330 bool sudden_termination_allowed_; |
317 | 331 |
318 // Set to true if we shouldn't send input events. We actually do the | 332 // Set to true if we shouldn't send input events. We actually do the |
319 // filtering for this at the render widget level. | 333 // filtering for this at the render widget level. |
(...skipping 26 matching lines...) Expand all Loading... |
346 #if defined(OS_ANDROID) | 360 #if defined(OS_ANDROID) |
347 scoped_refptr<BrowserDemuxerAndroid> browser_demuxer_android_; | 361 scoped_refptr<BrowserDemuxerAndroid> browser_demuxer_android_; |
348 #endif | 362 #endif |
349 | 363 |
350 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 364 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
351 }; | 365 }; |
352 | 366 |
353 } // namespace content | 367 } // namespace content |
354 | 368 |
355 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ | 369 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ |
OLD | NEW |