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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 if (delegate_ && render_frame_created_) | 363 if (delegate_ && render_frame_created_) |
364 delegate_->RenderFrameDeleted(this); | 364 delegate_->RenderFrameDeleted(this); |
365 | 365 |
366 // If this was the last active frame in the SiteInstance, the | 366 // If this was the last active frame in the SiteInstance, the |
367 // DecrementActiveFrameCount call will trigger the deletion of the | 367 // DecrementActiveFrameCount call will trigger the deletion of the |
368 // SiteInstance's proxies. | 368 // SiteInstance's proxies. |
369 GetSiteInstance()->DecrementActiveFrameCount(); | 369 GetSiteInstance()->DecrementActiveFrameCount(); |
370 | 370 |
371 // If this RenderFrameHost is swapping with a RenderFrameProxyHost, the | 371 // If this RenderFrameHost is swapping with a RenderFrameProxyHost, the |
372 // RenderFrame will already be deleted in the renderer process. Main frame | 372 // RenderFrame will already be deleted in the renderer process. Main frame |
373 // RenderFrames will be cleaned up as part of deleting its RenderView. In all | 373 // RenderFrames will be cleaned up as part of deleting its RenderView if the |
374 // other cases, the RenderFrame should be cleaned up (if it exists). | 374 // RenderView isn't in use by other frames. In all other cases, the |
375 if (is_active() && !frame_tree_node_->IsMainFrame() && render_frame_created_) | 375 // RenderFrame should be cleaned up (if it exists). |
| 376 bool will_render_view_clean_up_render_frame = |
| 377 frame_tree_node_->IsMainFrame() && render_view_host_->ref_count() == 1; |
| 378 if (is_active() && render_frame_created_ && |
| 379 !will_render_view_clean_up_render_frame) { |
376 Send(new FrameMsg_Delete(routing_id_)); | 380 Send(new FrameMsg_Delete(routing_id_)); |
| 381 } |
377 | 382 |
378 // Null out the swapout timer; in crash dumps this member will be null only if | 383 // Null out the swapout timer; in crash dumps this member will be null only if |
379 // the dtor has run. (It may also be null in tests.) | 384 // the dtor has run. (It may also be null in tests.) |
380 swapout_event_monitor_timeout_.reset(); | 385 swapout_event_monitor_timeout_.reset(); |
381 | 386 |
382 for (const auto& iter: visual_state_callbacks_) { | 387 for (const auto& iter: visual_state_callbacks_) { |
383 iter.second.Run(false); | 388 iter.second.Run(false); |
384 } | 389 } |
385 | 390 |
386 if (render_widget_host_ && | 391 if (render_widget_host_ && |
(...skipping 2792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3179 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3184 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
3180 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3185 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
3181 return web_bluetooth_service_.get(); | 3186 return web_bluetooth_service_.get(); |
3182 } | 3187 } |
3183 | 3188 |
3184 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3189 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
3185 web_bluetooth_service_.reset(); | 3190 web_bluetooth_service_.reset(); |
3186 } | 3191 } |
3187 | 3192 |
3188 } // namespace content | 3193 } // namespace content |
OLD | NEW |