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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 if (delegate_ && render_frame_created_) | 336 if (delegate_ && render_frame_created_) |
337 delegate_->RenderFrameDeleted(this); | 337 delegate_->RenderFrameDeleted(this); |
338 | 338 |
339 // If this was the last active frame in the SiteInstance, the | 339 // If this was the last active frame in the SiteInstance, the |
340 // DecrementActiveFrameCount call will trigger the deletion of the | 340 // DecrementActiveFrameCount call will trigger the deletion of the |
341 // SiteInstance's proxies. | 341 // SiteInstance's proxies. |
342 GetSiteInstance()->DecrementActiveFrameCount(); | 342 GetSiteInstance()->DecrementActiveFrameCount(); |
343 | 343 |
344 // If this RenderFrameHost is swapping with a RenderFrameProxyHost, the | 344 // If this RenderFrameHost is swapping with a RenderFrameProxyHost, the |
345 // RenderFrame will already be deleted in the renderer process. Main frame | 345 // RenderFrame will already be deleted in the renderer process. Main frame |
346 // RenderFrames will be cleaned up as part of deleting its RenderView. In all | 346 // RenderFrames will be cleaned up as part of deleting its RenderView if the |
347 // other cases, the RenderFrame should be cleaned up (if it exists). | 347 // RenderView isn't in use by other frames. In all other cases, the |
348 if (is_active() && !frame_tree_node_->IsMainFrame() && render_frame_created_) | 348 // RenderFrame should be cleaned up (if it exists). |
349 bool will_render_view_clean_up_render_frame = | |
350 frame_tree_node_->IsMainFrame() && render_view_host_->ref_count() == 1; | |
alexmos
2016/10/12 20:29:46
Previously, the FrameMsg_Delete wasn't getting sen
nasko
2016/10/13 21:26:28
I like the more direct test for it - the ref count
| |
351 if (is_active() && !will_render_view_clean_up_render_frame && | |
352 render_frame_created_) { | |
nasko
2016/10/13 21:26:28
nit: I'd put render_frame_created as the second bo
alexmos
2016/10/14 17:07:38
Done.
| |
349 Send(new FrameMsg_Delete(routing_id_)); | 353 Send(new FrameMsg_Delete(routing_id_)); |
354 } | |
350 | 355 |
351 // Null out the swapout timer; in crash dumps this member will be null only if | 356 // Null out the swapout timer; in crash dumps this member will be null only if |
352 // the dtor has run. (It may also be null in tests.) | 357 // the dtor has run. (It may also be null in tests.) |
353 swapout_event_monitor_timeout_.reset(); | 358 swapout_event_monitor_timeout_.reset(); |
354 | 359 |
355 for (const auto& iter: visual_state_callbacks_) { | 360 for (const auto& iter: visual_state_callbacks_) { |
356 iter.second.Run(false); | 361 iter.second.Run(false); |
357 } | 362 } |
358 | 363 |
359 if (render_widget_host_ && | 364 if (render_widget_host_ && |
(...skipping 2792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3152 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3157 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
3153 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3158 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
3154 return web_bluetooth_service_.get(); | 3159 return web_bluetooth_service_.get(); |
3155 } | 3160 } |
3156 | 3161 |
3157 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3162 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
3158 web_bluetooth_service_.reset(); | 3163 web_bluetooth_service_.reset(); |
3159 } | 3164 } |
3160 | 3165 |
3161 } // namespace content | 3166 } // namespace content |
OLD | NEW |