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 #include "content/browser/renderer_host/render_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 // handler. | 326 // handler. |
327 is_waiting_for_beforeunload_ack_ = true; | 327 is_waiting_for_beforeunload_ack_ = true; |
328 unload_ack_is_for_cross_site_transition_ = for_cross_site_transition; | 328 unload_ack_is_for_cross_site_transition_ = for_cross_site_transition; |
329 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 329 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
330 Send(new ViewMsg_ShouldClose(routing_id())); | 330 Send(new ViewMsg_ShouldClose(routing_id())); |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 void RenderViewHost::SwapOut(int new_render_process_host_id, | 334 void RenderViewHost::SwapOut(int new_render_process_host_id, |
335 int new_request_id) { | 335 int new_request_id) { |
336 // Start filtering IPC messages to avoid confusing the delegate. This will | |
337 // prevent any dialogs from appearing during unload handlers, but we've | |
338 // already decided to silence them in crbug.com/68780. We will set it back | |
339 // to false in SetNavigationsSuspended if we swap back in. | |
battre
2012/01/26 16:49:40
Has the situation changed for crbug.com/68780 ("Di
Charlie Reis
2012/01/26 17:03:16
That situation has not changed, but I view this as
| |
340 is_swapped_out_ = true; | |
341 | |
342 // This will be set back to false in OnSwapOutACK, just before we replace | 336 // This will be set back to false in OnSwapOutACK, just before we replace |
343 // this RVH with the pending RVH. | 337 // this RVH with the pending RVH. |
344 is_waiting_for_unload_ack_ = true; | 338 is_waiting_for_unload_ack_ = true; |
345 // Start the hang monitor in case the renderer hangs in the unload handler. | 339 // Start the hang monitor in case the renderer hangs in the unload handler. |
346 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 340 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
347 | 341 |
348 ViewMsg_SwapOut_Params params; | 342 ViewMsg_SwapOut_Params params; |
349 params.closing_process_id = process()->GetID(); | 343 params.closing_process_id = process()->GetID(); |
350 params.closing_route_id = routing_id(); | 344 params.closing_route_id = routing_id(); |
351 params.new_render_process_host_id = new_render_process_host_id; | 345 params.new_render_process_host_id = new_render_process_host_id; |
(...skipping 12 matching lines...) Expand all Loading... | |
364 // Stop the hang monitor now that the unload handler has finished. | 358 // Stop the hang monitor now that the unload handler has finished. |
365 StopHangMonitorTimeout(); | 359 StopHangMonitorTimeout(); |
366 is_waiting_for_unload_ack_ = false; | 360 is_waiting_for_unload_ack_ = false; |
367 delegate_->SwappedOut(this); | 361 delegate_->SwappedOut(this); |
368 } | 362 } |
369 | 363 |
370 void RenderViewHost::WasSwappedOut() { | 364 void RenderViewHost::WasSwappedOut() { |
371 // Don't bother reporting hung state anymore. | 365 // Don't bother reporting hung state anymore. |
372 StopHangMonitorTimeout(); | 366 StopHangMonitorTimeout(); |
373 | 367 |
368 // Now that we're no longer the active RVH in the tab, start filtering out | |
369 // most IPC messages. Usually the renderer will have stopped sending | |
370 // messages as of OnSwapOutACK. However, we may have timed out waiting | |
371 // for that message, and additional IPC messages may keep streaming in. | |
372 // We filter them out, as long as that won't cause problems (e.g., we | |
373 // still allow synchronous messages through). | |
374 is_swapped_out_ = true; | |
375 | |
374 // Inform the renderer that it can exit if no one else is using it. | 376 // Inform the renderer that it can exit if no one else is using it. |
375 Send(new ViewMsg_WasSwappedOut(routing_id())); | 377 Send(new ViewMsg_WasSwappedOut(routing_id())); |
376 } | 378 } |
377 | 379 |
378 void RenderViewHost::ClosePage() { | 380 void RenderViewHost::ClosePage() { |
379 // Start the hang monitor in case the renderer hangs in the unload handler. | 381 // Start the hang monitor in case the renderer hangs in the unload handler. |
380 is_waiting_for_unload_ack_ = true; | 382 is_waiting_for_unload_ack_ = true; |
381 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 383 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
382 | 384 |
383 if (IsRenderViewLive()) { | 385 if (IsRenderViewLive()) { |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1545 | 1547 |
1546 void RenderViewHost::OnWebUISend(const GURL& source_url, | 1548 void RenderViewHost::OnWebUISend(const GURL& source_url, |
1547 const std::string& name, | 1549 const std::string& name, |
1548 const base::ListValue& args) { | 1550 const base::ListValue& args) { |
1549 delegate_->WebUISend(this, source_url, name, args); | 1551 delegate_->WebUISend(this, source_url, name, args); |
1550 } | 1552 } |
1551 | 1553 |
1552 void RenderViewHost::ClearPowerSaveBlockers() { | 1554 void RenderViewHost::ClearPowerSaveBlockers() { |
1553 STLDeleteValues(&power_save_blockers_); | 1555 STLDeleteValues(&power_save_blockers_); |
1554 } | 1556 } |
OLD | NEW |