| 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_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 // Clear any state if a pending navigation is canceled or pre-empted. | 569 // Clear any state if a pending navigation is canceled or pre-empted. |
| 570 if (suspended_nav_params_) | 570 if (suspended_nav_params_) |
| 571 suspended_nav_params_.reset(); | 571 suspended_nav_params_.reset(); |
| 572 navigations_suspended_ = false; | 572 navigations_suspended_ = false; |
| 573 } | 573 } |
| 574 | 574 |
| 575 void RenderViewHostImpl::SuppressDialogsUntilSwapOut() { | 575 void RenderViewHostImpl::SuppressDialogsUntilSwapOut() { |
| 576 Send(new ViewMsg_SuppressDialogsUntilSwapOut(GetRoutingID())); | 576 Send(new ViewMsg_SuppressDialogsUntilSwapOut(GetRoutingID())); |
| 577 } | 577 } |
| 578 | 578 |
| 579 void RenderViewHostImpl::SwapOut() { | |
| 580 SetState(STATE_WAITING_FOR_UNLOAD_ACK); | |
| 581 unload_event_monitor_timeout_->Start( | |
| 582 base::TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | |
| 583 | |
| 584 if (IsRenderViewLive()) { | |
| 585 Send(new ViewMsg_SwapOut(GetRoutingID())); | |
| 586 } | |
| 587 delegate_->SwappedOut(this); | |
| 588 } | |
| 589 | |
| 590 void RenderViewHostImpl::OnSwapOutACK() { | |
| 591 OnSwappedOut(false); | |
| 592 } | |
| 593 | |
| 594 void RenderViewHostImpl::OnSwappedOut(bool timed_out) { | 579 void RenderViewHostImpl::OnSwappedOut(bool timed_out) { |
| 595 // Ignore spurious swap out ack. | 580 // Ignore spurious swap out ack. |
| 596 if (!IsWaitingForUnloadACK()) | 581 if (!IsWaitingForUnloadACK()) |
| 597 return; | 582 return; |
| 598 unload_event_monitor_timeout_->Stop(); | 583 unload_event_monitor_timeout_->Stop(); |
| 599 if (timed_out) { | 584 if (timed_out) { |
| 600 base::ProcessHandle process_handle = GetProcess()->GetHandle(); | 585 base::ProcessHandle process_handle = GetProcess()->GetHandle(); |
| 601 int views = 0; | 586 int views = 0; |
| 602 | 587 |
| 603 // Count the number of active widget hosts for the process, which | 588 // Count the number of active widget hosts for the process, which |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 OnRunJavaScriptMessage) | 1099 OnRunJavaScriptMessage) |
| 1115 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, | 1100 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, |
| 1116 OnRunBeforeUnloadConfirm) | 1101 OnRunBeforeUnloadConfirm) |
| 1117 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) | 1102 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) |
| 1118 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 1103 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
| 1119 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) | 1104 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) |
| 1120 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 1105 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
| 1121 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 1106 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
| 1122 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) | 1107 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) |
| 1123 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) | 1108 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) |
| 1124 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) | |
| 1125 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnSelectionChanged) | 1109 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnSelectionChanged) |
| 1126 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, | 1110 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, |
| 1127 OnSelectionBoundsChanged) | 1111 OnSelectionBoundsChanged) |
| 1128 #if defined(OS_ANDROID) | 1112 #if defined(OS_ANDROID) |
| 1129 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionRootBoundsChanged, | 1113 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionRootBoundsChanged, |
| 1130 OnSelectionRootBoundsChanged) | 1114 OnSelectionRootBoundsChanged) |
| 1131 #endif | 1115 #endif |
| 1132 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) | 1116 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) |
| 1133 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) | 1117 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) |
| 1134 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, | 1118 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 return true; | 1914 return true; |
| 1931 } | 1915 } |
| 1932 | 1916 |
| 1933 void RenderViewHostImpl::AttachToFrameTree() { | 1917 void RenderViewHostImpl::AttachToFrameTree() { |
| 1934 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1918 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1935 | 1919 |
| 1936 frame_tree->ResetForMainFrameSwap(); | 1920 frame_tree->ResetForMainFrameSwap(); |
| 1937 } | 1921 } |
| 1938 | 1922 |
| 1939 } // namespace content | 1923 } // namespace content |
| OLD | NEW |