Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 894843003: Move the RenderProcessGone IPC from RenderViewHost to RenderFrameHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix conflict with dalecurtis' CL Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, 374 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation,
374 OnBeginNavigation) 375 OnBeginNavigation)
375 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, 376 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse,
376 OnTextSurroundingSelectionResponse) 377 OnTextSurroundingSelectionResponse)
377 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) 378 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents)
378 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, 379 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges,
379 OnAccessibilityLocationChanges) 380 OnAccessibilityLocationChanges)
380 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, 381 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult,
381 OnAccessibilityFindInPageResult) 382 OnAccessibilityFindInPageResult)
382 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) 383 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen)
384 // The following message is synthetic and doesn't come from RenderFrame, but
385 // from RenderProcessHost.
386 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone)
383 #if defined(OS_MACOSX) || defined(OS_ANDROID) 387 #if defined(OS_MACOSX) || defined(OS_ANDROID)
384 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) 388 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup)
385 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) 389 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup)
386 #endif 390 #endif
387 IPC_END_MESSAGE_MAP() 391 IPC_END_MESSAGE_MAP()
388 392
389 // No further actions here, since we may have been deleted. 393 // No further actions here, since we may have been deleted.
390 return handled; 394 return handled;
391 } 395 }
392 396
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 1028
1025 bool RenderFrameHostImpl::SuddenTerminationAllowed() const { 1029 bool RenderFrameHostImpl::SuddenTerminationAllowed() const {
1026 return override_sudden_termination_status_ || 1030 return override_sudden_termination_status_ ||
1027 (!has_beforeunload_handlers_ && !has_unload_handlers_); 1031 (!has_beforeunload_handlers_ && !has_unload_handlers_);
1028 } 1032 }
1029 1033
1030 void RenderFrameHostImpl::OnSwapOutACK() { 1034 void RenderFrameHostImpl::OnSwapOutACK() {
1031 OnSwappedOut(); 1035 OnSwappedOut();
1032 } 1036 }
1033 1037
1038 void RenderFrameHostImpl::OnRenderProcessGone(int status, int exit_code) {
1039 if (frame_tree_node_->IsMainFrame()) {
1040 // Keep the termination status so we can get at it later when we
1041 // need to know why it died.
1042 render_view_host_->render_view_termination_status_ =
1043 static_cast<base::TerminationStatus>(status);
1044 }
1045
1046 SetRenderFrameCreated(false);
1047 InvalidateMojoConnection();
1048
1049 // Reset frame tree state associated with this process. This must happen
1050 // before RenderViewTerminated because observers expect the subframes of any
1051 // affected frames to be cleared first.
1052 // Note: When a RenderFrameHost is swapped out there is a different one
1053 // which is the current host. In this case, the FrameTreeNode state must
1054 // not be reset.
1055 if (!is_swapped_out())
1056 frame_tree_node_->ResetForNewProcess();
1057
1058 if (frame_tree_node_->IsMainFrame()) {
1059 // RenderViewHost/RenderWidgetHost needs to reset some stuff.
1060 render_view_host_->RendererExited(
1061 render_view_host_->render_view_termination_status_, exit_code);
1062
1063 render_view_host_->delegate_->RenderViewTerminated(
1064 render_view_host_, static_cast<base::TerminationStatus>(status),
1065 exit_code);
1066 }
1067 }
1068
1034 void RenderFrameHostImpl::OnSwappedOut() { 1069 void RenderFrameHostImpl::OnSwappedOut() {
1035 // Ignore spurious swap out ack. 1070 // Ignore spurious swap out ack.
1036 if (rfh_state_ != STATE_PENDING_SWAP_OUT) 1071 if (rfh_state_ != STATE_PENDING_SWAP_OUT)
1037 return; 1072 return;
1038 1073
1039 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); 1074 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this);
1040 swapout_event_monitor_timeout_->Stop(); 1075 swapout_event_monitor_timeout_->Stop();
1041 1076
1042 if (frame_tree_node_->render_manager()->DeleteFromPendingList(this)) { 1077 if (frame_tree_node_->render_manager()->DeleteFromPendingList(this)) {
1043 // We are now deleted. 1078 // We are now deleted.
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1879 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1845 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1880 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1846 GetContentClient()->browser()->RegisterPermissionUsage( 1881 GetContentClient()->browser()->RegisterPermissionUsage(
1847 PERMISSION_GEOLOCATION, 1882 PERMISSION_GEOLOCATION,
1848 delegate_->GetAsWebContents(), 1883 delegate_->GetAsWebContents(),
1849 GetLastCommittedURL().GetOrigin(), 1884 GetLastCommittedURL().GetOrigin(),
1850 top_frame->GetLastCommittedURL().GetOrigin()); 1885 top_frame->GetLastCommittedURL().GetOrigin());
1851 } 1886 }
1852 1887
1853 } // namespace content 1888 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698