OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RENDER_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void Attach(IPC::Channel::Listener* listener, int routing_id); | 94 void Attach(IPC::Channel::Listener* listener, int routing_id); |
95 | 95 |
96 // See Attach() | 96 // See Attach() |
97 void Release(int listener_id); | 97 void Release(int listener_id); |
98 | 98 |
99 // Listeners should call this when they've sent a "Close" message and | 99 // Listeners should call this when they've sent a "Close" message and |
100 // they're waiting for a "Close_ACK", so that if the renderer process | 100 // they're waiting for a "Close_ACK", so that if the renderer process |
101 // goes away we'll know that it was intentional rather than a crash. | 101 // goes away we'll know that it was intentional rather than a crash. |
102 void ReportExpectingClose(int32 listener_id); | 102 void ReportExpectingClose(int32 listener_id); |
103 | 103 |
| 104 // Track the count of pending views that are being swapped back in. Called |
| 105 // by listeners to register and unregister pending views to prevent the |
| 106 // process from exiting. |
| 107 void AddPendingView(); |
| 108 void RemovePendingView(); |
| 109 |
104 // Allows iteration over this RenderProcessHost's RenderViewHost listeners. | 110 // Allows iteration over this RenderProcessHost's RenderViewHost listeners. |
105 // Use from UI thread only. | 111 // Use from UI thread only. |
106 typedef IDMap<IPC::Channel::Listener>::const_iterator listeners_iterator; | 112 typedef IDMap<IPC::Channel::Listener>::const_iterator listeners_iterator; |
107 | 113 |
108 listeners_iterator ListenersIterator() { | 114 listeners_iterator ListenersIterator() { |
109 return listeners_iterator(&listeners_); | 115 return listeners_iterator(&listeners_); |
110 } | 116 } |
111 | 117 |
112 IPC::Channel::Listener* GetListenerByID(int routing_id) { | 118 IPC::Channel::Listener* GetListenerByID(int routing_id) { |
113 return listeners_.Lookup(routing_id); | 119 return listeners_.Lookup(routing_id); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 275 |
270 // The maximum page ID we've ever seen from the renderer process. | 276 // The maximum page ID we've ever seen from the renderer process. |
271 int32 max_page_id_; | 277 int32 max_page_id_; |
272 | 278 |
273 // True if fast shutdown has been performed on this RPH. | 279 // True if fast shutdown has been performed on this RPH. |
274 bool fast_shutdown_started_; | 280 bool fast_shutdown_started_; |
275 | 281 |
276 // True if we've posted a DeleteTask and will be deleted soon. | 282 // True if we've posted a DeleteTask and will be deleted soon. |
277 bool deleting_soon_; | 283 bool deleting_soon_; |
278 | 284 |
| 285 // The count of currently swapped out but pending RenderViews. We have |
| 286 // started to swap these in, so the renderer process should not exit if |
| 287 // this count is non-zero. |
| 288 int32 pending_views_; |
| 289 |
279 private: | 290 private: |
280 // The globally-unique identifier for this RPH. | 291 // The globally-unique identifier for this RPH. |
281 int id_; | 292 int id_; |
282 | 293 |
283 Profile* profile_; | 294 Profile* profile_; |
284 | 295 |
285 // set of listeners that expect the renderer process to close | 296 // set of listeners that expect the renderer process to close |
286 std::set<int> listeners_expecting_close_; | 297 std::set<int> listeners_expecting_close_; |
287 | 298 |
288 // True if the process can be shut down suddenly. If this is true, then we're | 299 // True if the process can be shut down suddenly. If this is true, then we're |
(...skipping 20 matching lines...) Expand all Loading... |
309 // Factory object for RenderProcessHosts. Using this factory allows tests to | 320 // Factory object for RenderProcessHosts. Using this factory allows tests to |
310 // swap out a different one to use a TestRenderProcessHost. | 321 // swap out a different one to use a TestRenderProcessHost. |
311 class RenderProcessHostFactory { | 322 class RenderProcessHostFactory { |
312 public: | 323 public: |
313 virtual ~RenderProcessHostFactory() {} | 324 virtual ~RenderProcessHostFactory() {} |
314 virtual RenderProcessHost* CreateRenderProcessHost( | 325 virtual RenderProcessHost* CreateRenderProcessHost( |
315 Profile* profile) const = 0; | 326 Profile* profile) const = 0; |
316 }; | 327 }; |
317 | 328 |
318 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ | 329 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ |
OLD | NEW |