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

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: Fixes based on Charlie's review. 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, 359 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation,
359 OnBeginNavigation) 360 OnBeginNavigation)
360 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, 361 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse,
361 OnTextSurroundingSelectionResponse) 362 OnTextSurroundingSelectionResponse)
362 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) 363 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents)
363 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, 364 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges,
364 OnAccessibilityLocationChanges) 365 OnAccessibilityLocationChanges)
365 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, 366 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult,
366 OnAccessibilityFindInPageResult) 367 OnAccessibilityFindInPageResult)
367 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) 368 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen)
369 // The following message is synthetic and doesn't come from RenderFrame, but
370 // from RenderProcessHost.
371 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone)
368 #if defined(OS_MACOSX) || defined(OS_ANDROID) 372 #if defined(OS_MACOSX) || defined(OS_ANDROID)
369 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) 373 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup)
370 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) 374 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup)
371 #endif 375 #endif
372 IPC_END_MESSAGE_MAP() 376 IPC_END_MESSAGE_MAP()
373 377
374 // No further actions here, since we may have been deleted. 378 // No further actions here, since we may have been deleted.
375 return handled; 379 return handled;
376 } 380 }
377 381
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 992
989 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const { 993 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const {
990 return render_view_host_->is_waiting_for_close_ack_ || 994 return render_view_host_->is_waiting_for_close_ack_ ||
991 rfh_state_ == STATE_PENDING_SWAP_OUT; 995 rfh_state_ == STATE_PENDING_SWAP_OUT;
992 } 996 }
993 997
994 void RenderFrameHostImpl::OnSwapOutACK() { 998 void RenderFrameHostImpl::OnSwapOutACK() {
995 OnSwappedOut(); 999 OnSwappedOut();
996 } 1000 }
997 1001
1002 void RenderFrameHostImpl::OnRenderProcessGone(int status, int exit_code) {
1003 if (frame_tree_node_->IsMainFrame()) {
1004 // Keep the termination status so we can get at it later when we
1005 // need to know why it died.
1006 render_view_host_->render_view_termination_status_ =
1007 static_cast<base::TerminationStatus>(status);
1008 }
1009
1010 // Reset frame tree state associated with this process. This must happen
1011 // before RenderViewTerminated because observers expect the subframes of any
1012 // affected frames to be cleared first.
1013 frame_tree_node_->frame_tree()->RenderProcessGone(render_view_host_);
Charlie Reis 2015/02/05 00:53:13 Looking closer, FrameTree::RenderProcessGone walks
nasko 2015/02/05 23:08:45 Good point! Inlined those two calls.
1014
1015 if (frame_tree_node_->IsMainFrame()) {
1016 // RenderViewHost/RenderWidgetHost needs to reset some stuff.
1017 render_view_host_->RendererExited(
1018 render_view_host_->render_view_termination_status_, exit_code);
1019
1020 render_view_host_->delegate_->RenderViewTerminated(
1021 render_view_host_, static_cast<base::TerminationStatus>(status),
1022 exit_code);
1023 }
1024 }
1025
998 void RenderFrameHostImpl::OnSwappedOut() { 1026 void RenderFrameHostImpl::OnSwappedOut() {
999 // Ignore spurious swap out ack. 1027 // Ignore spurious swap out ack.
1000 if (rfh_state_ != STATE_PENDING_SWAP_OUT) 1028 if (rfh_state_ != STATE_PENDING_SWAP_OUT)
1001 return; 1029 return;
1002 1030
1003 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); 1031 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this);
1004 swapout_event_monitor_timeout_->Stop(); 1032 swapout_event_monitor_timeout_->Stop();
1005 1033
1006 if (frame_tree_node_->render_manager()->DeleteFromPendingList(this)) { 1034 if (frame_tree_node_->render_manager()->DeleteFromPendingList(this)) {
1007 // We are now deleted. 1035 // We are now deleted.
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1799 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1772 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1800 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1773 GetContentClient()->browser()->RegisterPermissionUsage( 1801 GetContentClient()->browser()->RegisterPermissionUsage(
1774 PERMISSION_GEOLOCATION, 1802 PERMISSION_GEOLOCATION,
1775 delegate_->GetAsWebContents(), 1803 delegate_->GetAsWebContents(),
1776 GetLastCommittedURL().GetOrigin(), 1804 GetLastCommittedURL().GetOrigin(),
1777 top_frame->GetLastCommittedURL().GetOrigin()); 1805 top_frame->GetLastCommittedURL().GetOrigin());
1778 } 1806 }
1779 1807
1780 } // namespace content 1808 } // 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