OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/metrics/user_metrics_action.h" | 12 #include "base/metrics/user_metrics_action.h" |
13 #include "base/process/kill.h" | |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "content/browser/accessibility/accessibility_mode_helper.h" | 15 #include "content/browser/accessibility/accessibility_mode_helper.h" |
15 #include "content/browser/accessibility/browser_accessibility_manager.h" | 16 #include "content/browser/accessibility/browser_accessibility_manager.h" |
16 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 17 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
17 #include "content/browser/child_process_security_policy_impl.h" | 18 #include "content/browser/child_process_security_policy_impl.h" |
18 #include "content/browser/frame_host/cross_process_frame_connector.h" | 19 #include "content/browser/frame_host/cross_process_frame_connector.h" |
19 #include "content/browser/frame_host/cross_site_transferring_request.h" | 20 #include "content/browser/frame_host/cross_site_transferring_request.h" |
20 #include "content/browser/frame_host/frame_accessibility.h" | 21 #include "content/browser/frame_host/frame_accessibility.h" |
21 #include "content/browser/frame_host/frame_tree.h" | 22 #include "content/browser/frame_host/frame_tree.h" |
22 #include "content/browser/frame_host/frame_tree_node.h" | 23 #include "content/browser/frame_host/frame_tree_node.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 367 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
367 OnBeginNavigation) | 368 OnBeginNavigation) |
368 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 369 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
369 OnTextSurroundingSelectionResponse) | 370 OnTextSurroundingSelectionResponse) |
370 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 371 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
371 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 372 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
372 OnAccessibilityLocationChanges) | 373 OnAccessibilityLocationChanges) |
373 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, | 374 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, |
374 OnAccessibilityFindInPageResult) | 375 OnAccessibilityFindInPageResult) |
375 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) | 376 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) |
377 // The following message is synthetic and doesn't come from RenderFrame, but | |
378 // from RenderProcessHost. | |
379 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone) | |
376 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 380 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
377 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) | 381 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) |
378 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) | 382 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) |
379 #endif | 383 #endif |
380 IPC_END_MESSAGE_MAP() | 384 IPC_END_MESSAGE_MAP() |
381 | 385 |
382 // No further actions here, since we may have been deleted. | 386 // No further actions here, since we may have been deleted. |
383 return handled; | 387 return handled; |
384 } | 388 } |
385 | 389 |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1012 | 1016 |
1013 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const { | 1017 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const { |
1014 return render_view_host_->is_waiting_for_close_ack_ || | 1018 return render_view_host_->is_waiting_for_close_ack_ || |
1015 rfh_state_ == STATE_PENDING_SWAP_OUT; | 1019 rfh_state_ == STATE_PENDING_SWAP_OUT; |
1016 } | 1020 } |
1017 | 1021 |
1018 void RenderFrameHostImpl::OnSwapOutACK() { | 1022 void RenderFrameHostImpl::OnSwapOutACK() { |
1019 OnSwappedOut(); | 1023 OnSwappedOut(); |
1020 } | 1024 } |
1021 | 1025 |
1026 void RenderFrameHostImpl::OnRenderProcessGone(int status, int exit_code) { | |
1027 return; | |
1028 | |
1029 if (frame_tree_node_->IsMainFrame()) { | |
1030 // Keep the termination status so we can get at it later when we | |
1031 // need to know why it died. | |
1032 render_view_host_->render_view_termination_status_ = | |
1033 static_cast<base::TerminationStatus>(status); | |
1034 } | |
1035 | |
1036 SetRenderFrameCreated(false); | |
1037 InvalidateMojoConnection(); | |
1038 | |
1039 // Reset frame tree state associated with this process. This must happen | |
1040 // before RenderViewTerminated because observers expect the subframes of any | |
1041 // affected frames to be cleared first. | |
1042 // Note: Swapped out RenderFrameHost is owned by the RenderFrameProxyHost, | |
1043 // therefore it doesn't need to reset FrameTreeNode state. | |
nasko
2015/02/05 23:08:45
I accidentally slipped a rebase in, so the intra-p
Charlie Reis
2015/02/06 00:04:48
I don't quite understand the comment. Why does "o
nasko
2015/02/06 01:10:48
Done.
| |
1044 if (is_swapped_out()) | |
Charlie Reis
2015/02/06 00:04:48
Isn't this backwards? This only resets it if it's
nasko
2015/02/06 01:10:48
Indeed it is, I had different check before so slip
| |
1045 frame_tree_node_->ResetForNewProcess(); | |
1046 | |
1047 if (frame_tree_node_->IsMainFrame()) { | |
1048 // RenderViewHost/RenderWidgetHost needs to reset some stuff. | |
1049 render_view_host_->RendererExited( | |
1050 render_view_host_->render_view_termination_status_, exit_code); | |
1051 | |
1052 render_view_host_->delegate_->RenderViewTerminated( | |
1053 render_view_host_, static_cast<base::TerminationStatus>(status), | |
1054 exit_code); | |
1055 } | |
1056 } | |
1057 | |
1022 void RenderFrameHostImpl::OnSwappedOut() { | 1058 void RenderFrameHostImpl::OnSwappedOut() { |
1023 // Ignore spurious swap out ack. | 1059 // Ignore spurious swap out ack. |
1024 if (rfh_state_ != STATE_PENDING_SWAP_OUT) | 1060 if (rfh_state_ != STATE_PENDING_SWAP_OUT) |
1025 return; | 1061 return; |
1026 | 1062 |
1027 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); | 1063 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); |
1028 swapout_event_monitor_timeout_->Stop(); | 1064 swapout_event_monitor_timeout_->Stop(); |
1029 | 1065 |
1030 if (frame_tree_node_->render_manager()->DeleteFromPendingList(this)) { | 1066 if (frame_tree_node_->render_manager()->DeleteFromPendingList(this)) { |
1031 // We are now deleted. | 1067 // We are now deleted. |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1824 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1860 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1825 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1861 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1826 GetContentClient()->browser()->RegisterPermissionUsage( | 1862 GetContentClient()->browser()->RegisterPermissionUsage( |
1827 PERMISSION_GEOLOCATION, | 1863 PERMISSION_GEOLOCATION, |
1828 delegate_->GetAsWebContents(), | 1864 delegate_->GetAsWebContents(), |
1829 GetLastCommittedURL().GetOrigin(), | 1865 GetLastCommittedURL().GetOrigin(), |
1830 top_frame->GetLastCommittedURL().GetOrigin()); | 1866 top_frame->GetLastCommittedURL().GetOrigin()); |
1831 } | 1867 } |
1832 | 1868 |
1833 } // namespace content | 1869 } // namespace content |
OLD | NEW |