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

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: Resolve conflicts 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
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 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 // reset. 1471 // reset.
1472 SetRenderFrameCreated(false); 1472 SetRenderFrameCreated(false);
1473 InvalidateMojoConnection(); 1473 InvalidateMojoConnection();
1474 1474
1475 // Execute any pending AX tree snapshot callbacks with an empty response, 1475 // Execute any pending AX tree snapshot callbacks with an empty response,
1476 // since we're never going to get a response from this renderer. 1476 // since we're never going to get a response from this renderer.
1477 for (const auto& iter : ax_tree_snapshot_callbacks_) 1477 for (const auto& iter : ax_tree_snapshot_callbacks_)
1478 iter.second.Run(ui::AXTreeUpdate()); 1478 iter.second.Run(ui::AXTreeUpdate());
1479 ax_tree_snapshot_callbacks_.clear(); 1479 ax_tree_snapshot_callbacks_.clear();
1480 1480
1481 // If the process has died, we don't need to wait for the swap out ack from 1481 if (!is_active()) {
1482 // this RenderFrame if it is pending deletion. Complete the swap out to 1482 // If the process has died, we don't need to wait for the swap out ack from
1483 // destroy it. 1483 // this RenderFrame if it is pending deletion. Complete the swap out to
1484 if (!is_active()) 1484 // destroy it.
1485 OnSwappedOut(); 1485 OnSwappedOut();
1486 } else {
1487 // If this was the current pending or speculative RFH dying, cancel and
1488 // destroy it.
1489 frame_tree_node_->render_manager()->CancelPendingIfNecessary(this);
1490 }
1486 1491
1487 // Note: don't add any more code at this point in the function because 1492 // 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 1493 // |this| may be deleted. Any additional cleanup should happen before
1489 // the last block of code here. 1494 // the last block of code here.
1490 } 1495 }
1491 1496
1492 void RenderFrameHostImpl::OnSwappedOut() { 1497 void RenderFrameHostImpl::OnSwappedOut() {
1493 // Ignore spurious swap out ack. 1498 // Ignore spurious swap out ack.
1494 if (!is_waiting_for_swapout_ack_) 1499 if (!is_waiting_for_swapout_ack_)
1495 return; 1500 return;
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 } 2138 }
2134 #endif 2139 #endif
2135 2140
2136 GetContentClient()->browser()->RegisterRenderFrameMojoInterfaces( 2141 GetContentClient()->browser()->RegisterRenderFrameMojoInterfaces(
2137 GetInterfaceRegistry(), this); 2142 GetInterfaceRegistry(), this);
2138 } 2143 }
2139 2144
2140 void RenderFrameHostImpl::ResetWaitingState() { 2145 void RenderFrameHostImpl::ResetWaitingState() {
2141 DCHECK(is_active()); 2146 DCHECK(is_active());
2142 2147
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);
alexmos 2016/08/08 23:59:01 Looking at whether this might affect is_active() u
nasko 2016/08/09 18:32:32 I don't know and don't recall :(. However, bindin
alexmos 2016/08/09 23:09:46 Ah, this is probably fine then. Thanks!
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 2148 // 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 2149 // or close acks. We clear them here to be safe, since they can cause
2152 // navigations to be ignored in OnDidCommitProvisionalLoad. 2150 // navigations to be ignored in OnDidCommitProvisionalLoad.
2153 if (is_waiting_for_beforeunload_ack_) { 2151 if (is_waiting_for_beforeunload_ack_) {
2154 is_waiting_for_beforeunload_ack_ = false; 2152 is_waiting_for_beforeunload_ack_ = false;
2155 render_view_host_->GetWidget()->decrement_in_flight_event_count(); 2153 render_view_host_->GetWidget()->decrement_in_flight_event_count();
2156 render_view_host_->GetWidget()->StopHangMonitorTimeout(); 2154 render_view_host_->GetWidget()->StopHangMonitorTimeout();
2157 } 2155 }
2158 send_before_unload_start_time_ = base::TimeTicks(); 2156 send_before_unload_start_time_ = base::TimeTicks();
2159 render_view_host_->is_waiting_for_close_ack_ = false; 2157 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( 3034 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
3037 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 3035 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
3038 return web_bluetooth_service_.get(); 3036 return web_bluetooth_service_.get();
3039 } 3037 }
3040 3038
3041 void RenderFrameHostImpl::DeleteWebBluetoothService() { 3039 void RenderFrameHostImpl::DeleteWebBluetoothService() {
3042 web_bluetooth_service_.reset(); 3040 web_bluetooth_service_.reset();
3043 } 3041 }
3044 3042
3045 } // namespace content 3043 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698