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

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

Issue 1886413002: Always swap with a replacement proxy in OnSwapOut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile Created 4 years, 8 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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 if (!is_active()) { 1207 if (!is_active()) {
1208 NOTREACHED() << "RFH should be in default state when calling SwapOut."; 1208 NOTREACHED() << "RFH should be in default state when calling SwapOut.";
1209 return; 1209 return;
1210 } 1210 }
1211 1211
1212 if (swapout_event_monitor_timeout_) { 1212 if (swapout_event_monitor_timeout_) {
1213 swapout_event_monitor_timeout_->Start(base::TimeDelta::FromMilliseconds( 1213 swapout_event_monitor_timeout_->Start(base::TimeDelta::FromMilliseconds(
1214 RenderViewHostImpl::kUnloadTimeoutMS)); 1214 RenderViewHostImpl::kUnloadTimeoutMS));
1215 } 1215 }
1216 1216
1217 // There may be no proxy if there are no active views in the process. 1217 // There should always be a proxy to replace the old RenderFrameHost. If
1218 int proxy_routing_id = MSG_ROUTING_NONE; 1218 // there are no remaining active views in the process, the proxy will be
1219 FrameReplicationState replication_state; 1219 // short-lived and will be deleted when the SwapOut ACK is received.
1220 if (proxy) { 1220 DCHECK(proxy);
Charlie Reis 2016/04/22 19:11:33 Given the trouble we've had here, let's make this
alexmos 2016/04/25 18:17:08 Done.
1221 set_render_frame_proxy_host(proxy); 1221
1222 proxy_routing_id = proxy->GetRoutingID(); 1222 set_render_frame_proxy_host(proxy);
1223 replication_state = proxy->frame_tree_node()->current_replication_state(); 1223 int proxy_routing_id = proxy->GetRoutingID();
Charlie Reis 2016/04/22 19:11:33 nit: Move proxy_routing_id and replication_state i
alexmos 2016/04/25 18:17:08 Done.
1224 } 1224 FrameReplicationState replication_state =
1225 proxy->frame_tree_node()->current_replication_state();
1225 1226
1226 if (IsRenderFrameLive()) { 1227 if (IsRenderFrameLive()) {
1227 Send(new FrameMsg_SwapOut(routing_id_, proxy_routing_id, is_loading, 1228 Send(new FrameMsg_SwapOut(routing_id_, proxy_routing_id, is_loading,
1228 replication_state)); 1229 replication_state));
1229 } 1230 }
1230 1231
1231 // TODO(nasko): If the frame is not live, the RFH should just be deleted by 1232 // TODO(nasko): If the frame is not live, the RFH should just be deleted by
1232 // simulating the receipt of swap out ack. 1233 // simulating the receipt of swap out ack.
1233 is_waiting_for_swapout_ack_ = true; 1234 is_waiting_for_swapout_ack_ = true;
1234 if (frame_tree_node_->IsMainFrame()) 1235 if (frame_tree_node_->IsMainFrame())
1235 render_view_host_->set_is_active(false); 1236 render_view_host_->set_is_active(false);
1236 1237
1237 // If this is the last active frame in the SiteInstance, the
1238 // DecrementActiveFrameCount call will trigger the deletion of the
1239 // SiteInstance's proxies.
1240 GetSiteInstance()->DecrementActiveFrameCount();
Charlie Reis 2016/04/22 19:11:33 This seems like a real change-- pending delete RFH
alexmos 2016/04/25 18:17:08 You're right, I've verified that we would miss cal
Charlie Reis 2016/04/26 05:06:36 Acknowledged.
1241
1242 if (!GetParent()) 1238 if (!GetParent())
1243 delegate_->SwappedOut(this); 1239 delegate_->SwappedOut(this);
1244 } 1240 }
1245 1241
1246 void RenderFrameHostImpl::OnBeforeUnloadACK( 1242 void RenderFrameHostImpl::OnBeforeUnloadACK(
1247 bool proceed, 1243 bool proceed,
1248 const base::TimeTicks& renderer_before_unload_start_time, 1244 const base::TimeTicks& renderer_before_unload_start_time,
1249 const base::TimeTicks& renderer_before_unload_end_time) { 1245 const base::TimeTicks& renderer_before_unload_end_time) {
1250 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this, 1246 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this,
1251 "FrameTreeNode id", 1247 "FrameTreeNode id",
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 // Ignore spurious swap out ack. 1379 // Ignore spurious swap out ack.
1384 if (!is_waiting_for_swapout_ack_) 1380 if (!is_waiting_for_swapout_ack_)
1385 return; 1381 return;
1386 1382
1387 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); 1383 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this);
1388 if (swapout_event_monitor_timeout_) 1384 if (swapout_event_monitor_timeout_)
1389 swapout_event_monitor_timeout_->Stop(); 1385 swapout_event_monitor_timeout_->Stop();
1390 1386
1391 ClearAllWebUI(); 1387 ClearAllWebUI();
1392 1388
1389 // If this was the last active frame in the SiteInstance, the
1390 // DecrementActiveFrameCount call will trigger the deletion of the
1391 // SiteInstance's proxies.
1392 GetSiteInstance()->DecrementActiveFrameCount();
Charlie Reis 2016/04/22 19:11:33 As noted above, we may just want to do this uncond
alexmos 2016/04/25 18:17:08 Done.
1393
1393 // If this is a main frame RFH that's about to be deleted, update its RVH's 1394 // If this is a main frame RFH that's about to be deleted, update its RVH's
1394 // swapped-out state here. https://crbug.com/505887 1395 // swapped-out state here. https://crbug.com/505887
1395 if (frame_tree_node_->IsMainFrame()) { 1396 if (frame_tree_node_->IsMainFrame()) {
1396 render_view_host_->set_is_active(false); 1397 render_view_host_->set_is_active(false);
1397 render_view_host_->set_is_swapped_out(true); 1398 render_view_host_->set_is_swapped_out(true);
1398 } 1399 }
1399 1400
1400 bool deleted = 1401 bool deleted =
1401 frame_tree_node_->render_manager()->DeleteFromPendingList(this); 1402 frame_tree_node_->render_manager()->DeleteFromPendingList(this);
1402 CHECK(deleted); 1403 CHECK(deleted);
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 // handler after it's destroyed so it can't run after the RFHI is destroyed. 2773 // handler after it's destroyed so it can't run after the RFHI is destroyed.
2773 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 2774 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
2774 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 2775 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
2775 } 2776 }
2776 2777
2777 void RenderFrameHostImpl::DeleteWebBluetoothService() { 2778 void RenderFrameHostImpl::DeleteWebBluetoothService() {
2778 web_bluetooth_service_.reset(); 2779 web_bluetooth_service_.reset();
2779 } 2780 }
2780 2781
2781 } // namespace content 2782 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698