OLD | NEW |
---|---|
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 | 256 |
257 GetProcess()->RemoveRoute(routing_id_); | 257 GetProcess()->RemoveRoute(routing_id_); |
258 g_routing_id_frame_map.Get().erase( | 258 g_routing_id_frame_map.Get().erase( |
259 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); | 259 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); |
260 | 260 |
261 site_instance_->RemoveObserver(this); | 261 site_instance_->RemoveObserver(this); |
262 | 262 |
263 if (delegate_ && render_frame_created_) | 263 if (delegate_ && render_frame_created_) |
264 delegate_->RenderFrameDeleted(this); | 264 delegate_->RenderFrameDeleted(this); |
265 | 265 |
266 // If this RenderFrameHost is swapped out, it already decremented the active | 266 // If this was the last active frame in the SiteInstance, the |
267 // frame count of the SiteInstance it belongs to. | 267 // DecrementActiveFrameCount call will trigger the deletion of the |
268 if (is_active()) | 268 // SiteInstance's proxies. |
269 GetSiteInstance()->DecrementActiveFrameCount(); | 269 GetSiteInstance()->DecrementActiveFrameCount(); |
270 | 270 |
271 // If this RenderFrameHost is swapping with a RenderFrameProxyHost, the | 271 // If this RenderFrameHost is swapping with a RenderFrameProxyHost, the |
272 // RenderFrame will already be deleted in the renderer process. Main frame | 272 // RenderFrame will already be deleted in the renderer process. Main frame |
273 // RenderFrames will be cleaned up as part of deleting its RenderView. In all | 273 // RenderFrames will be cleaned up as part of deleting its RenderView. In all |
274 // other cases, the RenderFrame should be cleaned up (if it exists). | 274 // other cases, the RenderFrame should be cleaned up (if it exists). |
275 if (is_active() && !frame_tree_node_->IsMainFrame() && render_frame_created_) | 275 if (is_active() && !frame_tree_node_->IsMainFrame() && render_frame_created_) |
276 Send(new FrameMsg_Delete(routing_id_)); | 276 Send(new FrameMsg_Delete(routing_id_)); |
277 | 277 |
278 // Null out the swapout timer; in crash dumps this member will be null only if | 278 // Null out the swapout timer; in crash dumps this member will be null only if |
279 // the dtor has run. (It may also be null in tests.) | 279 // the dtor has run. (It may also be null in tests.) |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 CHECK(proxy); |
1221 set_render_frame_proxy_host(proxy); | 1221 |
1222 proxy_routing_id = proxy->GetRoutingID(); | 1222 set_render_frame_proxy_host(proxy); |
nasko
2016/04/26 19:41:02
Ugh, this isn't needed, but I'll get rid of it in
| |
1223 replication_state = proxy->frame_tree_node()->current_replication_state(); | |
1224 } | |
1225 | 1223 |
1226 if (IsRenderFrameLive()) { | 1224 if (IsRenderFrameLive()) { |
1227 Send(new FrameMsg_SwapOut(routing_id_, proxy_routing_id, is_loading, | 1225 FrameReplicationState replication_state = |
1226 proxy->frame_tree_node()->current_replication_state(); | |
1227 Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID(), is_loading, | |
1228 replication_state)); | 1228 replication_state)); |
1229 } | 1229 } |
1230 | 1230 |
1231 // TODO(nasko): If the frame is not live, the RFH should just be deleted by | 1231 // TODO(nasko): If the frame is not live, the RFH should just be deleted by |
1232 // simulating the receipt of swap out ack. | 1232 // simulating the receipt of swap out ack. |
1233 is_waiting_for_swapout_ack_ = true; | 1233 is_waiting_for_swapout_ack_ = true; |
1234 if (frame_tree_node_->IsMainFrame()) | 1234 if (frame_tree_node_->IsMainFrame()) |
1235 render_view_host_->set_is_active(false); | 1235 render_view_host_->set_is_active(false); |
1236 | 1236 |
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(); | |
1241 | |
1242 if (!GetParent()) | 1237 if (!GetParent()) |
1243 delegate_->SwappedOut(this); | 1238 delegate_->SwappedOut(this); |
1244 } | 1239 } |
1245 | 1240 |
1246 void RenderFrameHostImpl::OnBeforeUnloadACK( | 1241 void RenderFrameHostImpl::OnBeforeUnloadACK( |
1247 bool proceed, | 1242 bool proceed, |
1248 const base::TimeTicks& renderer_before_unload_start_time, | 1243 const base::TimeTicks& renderer_before_unload_start_time, |
1249 const base::TimeTicks& renderer_before_unload_end_time) { | 1244 const base::TimeTicks& renderer_before_unload_end_time) { |
1250 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this, | 1245 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this, |
1251 "FrameTreeNode id", | 1246 "FrameTreeNode id", |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2772 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2767 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
2773 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2768 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
2774 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2769 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
2775 } | 2770 } |
2776 | 2771 |
2777 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2772 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
2778 web_bluetooth_service_.reset(); | 2773 web_bluetooth_service_.reset(); |
2779 } | 2774 } |
2780 | 2775 |
2781 } // namespace content | 2776 } // namespace content |
OLD | NEW |