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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 4e4c97ae48d538e7b08119d120de39de21e31b3a..91775d794a05001f9c36b92238498db44b7fa0b4 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -1214,14 +1214,15 @@ void RenderFrameHostImpl::SwapOut(
RenderViewHostImpl::kUnloadTimeoutMS));
}
- // There may be no proxy if there are no active views in the process.
- int proxy_routing_id = MSG_ROUTING_NONE;
- FrameReplicationState replication_state;
- if (proxy) {
- set_render_frame_proxy_host(proxy);
- proxy_routing_id = proxy->GetRoutingID();
- replication_state = proxy->frame_tree_node()->current_replication_state();
- }
+ // There should always be a proxy to replace the old RenderFrameHost. If
+ // there are no remaining active views in the process, the proxy will be
+ // short-lived and will be deleted when the SwapOut ACK is received.
+ 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.
+
+ set_render_frame_proxy_host(proxy);
+ 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.
+ FrameReplicationState replication_state =
+ proxy->frame_tree_node()->current_replication_state();
if (IsRenderFrameLive()) {
Send(new FrameMsg_SwapOut(routing_id_, proxy_routing_id, is_loading,
@@ -1234,11 +1235,6 @@ void RenderFrameHostImpl::SwapOut(
if (frame_tree_node_->IsMainFrame())
render_view_host_->set_is_active(false);
- // If this is the last active frame in the SiteInstance, the
- // DecrementActiveFrameCount call will trigger the deletion of the
- // SiteInstance's proxies.
- 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.
-
if (!GetParent())
delegate_->SwappedOut(this);
}
@@ -1390,6 +1386,11 @@ void RenderFrameHostImpl::OnSwappedOut() {
ClearAllWebUI();
+ // If this was the last active frame in the SiteInstance, the
+ // DecrementActiveFrameCount call will trigger the deletion of the
+ // SiteInstance's proxies.
+ 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.
+
// If this is a main frame RFH that's about to be deleted, update its RVH's
// swapped-out state here. https://crbug.com/505887
if (frame_tree_node_->IsMainFrame()) {

Powered by Google App Engine
This is Rietveld 408576698