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

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

Issue 2226023003: Fix RenderView reuse issues after a pending RenderFrameHost dies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback from creis@ and nasko@ Created 4 years, 4 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
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 973
974 OpenURL(params, GetSiteInstance()); 974 OpenURL(params, GetSiteInstance());
975 } 975 }
976 976
977 void RenderFrameHostImpl::OnCancelInitialHistoryLoad() { 977 void RenderFrameHostImpl::OnCancelInitialHistoryLoad() {
978 // A Javascript navigation interrupted the initial history load. Check if an 978 // A Javascript navigation interrupted the initial history load. Check if an
979 // initial subframe cross-process navigation needs to be canceled as a result. 979 // initial subframe cross-process navigation needs to be canceled as a result.
980 // TODO(creis, clamy): Cancel any cross-process navigation in PlzNavigate. 980 // TODO(creis, clamy): Cancel any cross-process navigation in PlzNavigate.
981 if (GetParent() && !frame_tree_node_->has_committed_real_load() && 981 if (GetParent() && !frame_tree_node_->has_committed_real_load() &&
982 frame_tree_node_->render_manager()->pending_frame_host()) { 982 frame_tree_node_->render_manager()->pending_frame_host()) {
983 frame_tree_node_->render_manager()->CancelPending(); 983 frame_tree_node_->render_manager()->CancelPendingIfNecessary(
984 frame_tree_node_->render_manager()->pending_frame_host());
984 } 985 }
985 } 986 }
986 987
987 void RenderFrameHostImpl::OnDocumentOnLoadCompleted( 988 void RenderFrameHostImpl::OnDocumentOnLoadCompleted(
988 FrameMsg_UILoadMetricsReportType::Value report_type, 989 FrameMsg_UILoadMetricsReportType::Value report_type,
989 base::TimeTicks ui_timestamp) { 990 base::TimeTicks ui_timestamp) {
990 if (report_type == FrameMsg_UILoadMetricsReportType::REPORT_LINK) { 991 if (report_type == FrameMsg_UILoadMetricsReportType::REPORT_LINK) {
991 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.UI_OnLoadComplete.Link", 992 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.UI_OnLoadComplete.Link",
992 base::TimeTicks::Now() - ui_timestamp, 993 base::TimeTicks::Now() - ui_timestamp,
993 base::TimeDelta::FromMilliseconds(10), 994 base::TimeDelta::FromMilliseconds(10),
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 // reset. 1472 // reset.
1472 SetRenderFrameCreated(false); 1473 SetRenderFrameCreated(false);
1473 InvalidateMojoConnection(); 1474 InvalidateMojoConnection();
1474 1475
1475 // Execute any pending AX tree snapshot callbacks with an empty response, 1476 // Execute any pending AX tree snapshot callbacks with an empty response,
1476 // since we're never going to get a response from this renderer. 1477 // since we're never going to get a response from this renderer.
1477 for (const auto& iter : ax_tree_snapshot_callbacks_) 1478 for (const auto& iter : ax_tree_snapshot_callbacks_)
1478 iter.second.Run(ui::AXTreeUpdate()); 1479 iter.second.Run(ui::AXTreeUpdate());
1479 ax_tree_snapshot_callbacks_.clear(); 1480 ax_tree_snapshot_callbacks_.clear();
1480 1481
1481 // If the process has died, we don't need to wait for the swap out ack from 1482 if (!is_active()) {
1482 // this RenderFrame if it is pending deletion. Complete the swap out to 1483 // If the process has died, we don't need to wait for the swap out ack from
1483 // destroy it. 1484 // this RenderFrame if it is pending deletion. Complete the swap out to
1484 if (!is_active()) 1485 // destroy it.
1485 OnSwappedOut(); 1486 OnSwappedOut();
1487 } else {
1488 // If this was the current pending or speculative RFH dying, cancel and
1489 // destroy it.
1490 frame_tree_node_->render_manager()->CancelPendingIfNecessary(this);
1491 }
1486 1492
1487 // Note: don't add any more code at this point in the function because 1493 // Note: don't add any more code at this point in the function because
1488 // |this| may be deleted. Any additional cleanup should happen before 1494 // |this| may be deleted. Any additional cleanup should happen before
1489 // the last block of code here. 1495 // the last block of code here.
1490 } 1496 }
1491 1497
1492 void RenderFrameHostImpl::OnSwappedOut() { 1498 void RenderFrameHostImpl::OnSwappedOut() {
1493 // Ignore spurious swap out ack. 1499 // Ignore spurious swap out ack.
1494 if (!is_waiting_for_swapout_ack_) 1500 if (!is_waiting_for_swapout_ack_)
1495 return; 1501 return;
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 } 2139 }
2134 #endif 2140 #endif
2135 2141
2136 GetContentClient()->browser()->RegisterRenderFrameMojoInterfaces( 2142 GetContentClient()->browser()->RegisterRenderFrameMojoInterfaces(
2137 GetInterfaceRegistry(), this); 2143 GetInterfaceRegistry(), this);
2138 } 2144 }
2139 2145
2140 void RenderFrameHostImpl::ResetWaitingState() { 2146 void RenderFrameHostImpl::ResetWaitingState() {
2141 DCHECK(is_active()); 2147 DCHECK(is_active());
2142 2148
2143 // The active state of the RVH is determined by its main frame, since
2144 // subframes should have their own widgets.
2145 if (frame_tree_node_->IsMainFrame()) {
2146 render_view_host_->set_is_active(true);
2147 render_view_host_->set_is_swapped_out(false);
2148 }
2149
2150 // Whenever we reset the RFH state, we should not be waiting for beforeunload 2149 // Whenever we reset the RFH state, we should not be waiting for beforeunload
2151 // or close acks. We clear them here to be safe, since they can cause 2150 // or close acks. We clear them here to be safe, since they can cause
2152 // navigations to be ignored in OnDidCommitProvisionalLoad. 2151 // navigations to be ignored in OnDidCommitProvisionalLoad.
2153 if (is_waiting_for_beforeunload_ack_) { 2152 if (is_waiting_for_beforeunload_ack_) {
2154 is_waiting_for_beforeunload_ack_ = false; 2153 is_waiting_for_beforeunload_ack_ = false;
2155 render_view_host_->GetWidget()->decrement_in_flight_event_count(); 2154 render_view_host_->GetWidget()->decrement_in_flight_event_count();
2156 render_view_host_->GetWidget()->StopHangMonitorTimeout(); 2155 render_view_host_->GetWidget()->StopHangMonitorTimeout();
2157 } 2156 }
2158 send_before_unload_start_time_ = base::TimeTicks(); 2157 send_before_unload_start_time_ = base::TimeTicks();
2159 render_view_host_->is_waiting_for_close_ack_ = false; 2158 render_view_host_->is_waiting_for_close_ack_ = false;
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
3036 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 3035 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
3037 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 3036 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
3038 return web_bluetooth_service_.get(); 3037 return web_bluetooth_service_.get();
3039 } 3038 }
3040 3039
3041 void RenderFrameHostImpl::DeleteWebBluetoothService() { 3040 void RenderFrameHostImpl::DeleteWebBluetoothService() {
3042 web_bluetooth_service_.reset(); 3041 web_bluetooth_service_.reset();
3043 } 3042 }
3044 3043
3045 } // namespace content 3044 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698