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" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 358 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
359 OnBeginNavigation) | 359 OnBeginNavigation) |
360 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 360 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
361 OnTextSurroundingSelectionResponse) | 361 OnTextSurroundingSelectionResponse) |
362 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 362 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
363 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 363 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
364 OnAccessibilityLocationChanges) | 364 OnAccessibilityLocationChanges) |
365 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, | 365 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, |
366 OnAccessibilityFindInPageResult) | 366 OnAccessibilityFindInPageResult) |
367 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) | 367 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) |
368 // The following message is synthetic and doesn't come from RenderFrame, but | |
369 // from RenderProcessHost. | |
370 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone) | |
368 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 371 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
369 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) | 372 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) |
370 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) | 373 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) |
371 #endif | 374 #endif |
372 IPC_END_MESSAGE_MAP() | 375 IPC_END_MESSAGE_MAP() |
373 | 376 |
374 // No further actions here, since we may have been deleted. | 377 // No further actions here, since we may have been deleted. |
375 return handled; | 378 return handled; |
376 } | 379 } |
377 | 380 |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
988 | 991 |
989 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const { | 992 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const { |
990 return render_view_host_->is_waiting_for_close_ack_ || | 993 return render_view_host_->is_waiting_for_close_ack_ || |
991 rfh_state_ == STATE_PENDING_SWAP_OUT; | 994 rfh_state_ == STATE_PENDING_SWAP_OUT; |
992 } | 995 } |
993 | 996 |
994 void RenderFrameHostImpl::OnSwapOutACK() { | 997 void RenderFrameHostImpl::OnSwapOutACK() { |
995 OnSwappedOut(); | 998 OnSwappedOut(); |
996 } | 999 } |
997 | 1000 |
1001 void RenderFrameHostImpl::OnRenderProcessGone(int status, int exit_code) { | |
1002 // Reset frame tree state associated with this process. This must happen | |
1003 // before RenderViewTerminated because observers expect the subframes of any | |
1004 // affected frames to be cleared first. | |
1005 frame_tree_node_->frame_tree()->RenderProcessGone(render_view_host_); | |
Charlie Reis
2015/02/03 01:06:35
Does OnRenderProcessGone get called once per frame
nasko
2015/02/04 16:51:31
It is indeed called once per frame. Ideally it wil
| |
1006 | |
1007 if (frame_tree_node_->IsMainFrame()) { | |
1008 // Keep the termination status so we can get at it later when we | |
1009 // need to know why it died. | |
1010 render_view_host_->render_view_termination_status_ = | |
Charlie Reis
2015/02/03 01:06:35
Sanity check: This used to be set before the Frame
nasko
2015/02/04 16:51:31
I don't think I can reasonably guarantee this. The
| |
1011 static_cast<base::TerminationStatus>(status); | |
1012 | |
1013 // Our base class RenderWidgetHost needs to reset some stuff. | |
Charlie Reis
2015/02/03 01:06:35
nit: Not our base class anymore.
nasko
2015/02/04 16:51:31
Done.
| |
1014 render_view_host_->RendererExited( | |
1015 render_view_host_->render_view_termination_status_, exit_code); | |
1016 | |
1017 render_view_host_->delegate_->RenderViewTerminated( | |
1018 render_view_host_, static_cast<base::TerminationStatus>(status), | |
1019 exit_code); | |
1020 } | |
1021 } | |
1022 | |
998 void RenderFrameHostImpl::OnSwappedOut() { | 1023 void RenderFrameHostImpl::OnSwappedOut() { |
999 // Ignore spurious swap out ack. | 1024 // Ignore spurious swap out ack. |
1000 if (rfh_state_ != STATE_PENDING_SWAP_OUT) | 1025 if (rfh_state_ != STATE_PENDING_SWAP_OUT) |
1001 return; | 1026 return; |
1002 | 1027 |
1003 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); | 1028 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); |
1004 swapout_event_monitor_timeout_->Stop(); | 1029 swapout_event_monitor_timeout_->Stop(); |
1005 | 1030 |
1006 if (frame_tree_node_->render_manager()->DeleteFromPendingList(this)) { | 1031 if (frame_tree_node_->render_manager()->DeleteFromPendingList(this)) { |
1007 // We are now deleted. | 1032 // We are now deleted. |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1771 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1796 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1772 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1797 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1773 GetContentClient()->browser()->RegisterPermissionUsage( | 1798 GetContentClient()->browser()->RegisterPermissionUsage( |
1774 PERMISSION_GEOLOCATION, | 1799 PERMISSION_GEOLOCATION, |
1775 delegate_->GetAsWebContents(), | 1800 delegate_->GetAsWebContents(), |
1776 GetLastCommittedURL().GetOrigin(), | 1801 GetLastCommittedURL().GetOrigin(), |
1777 top_frame->GetLastCommittedURL().GetOrigin()); | 1802 top_frame->GetLastCommittedURL().GetOrigin()); |
1778 } | 1803 } |
1779 | 1804 |
1780 } // namespace content | 1805 } // namespace content |
OLD | NEW |