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_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 // its RenderViewHost, mark it for deletion as well so that we don't try to | 713 // its RenderViewHost, mark it for deletion as well so that we don't try to |
714 // reuse it. | 714 // reuse it. |
715 if (render_frame_host->frame_tree_node()->IsMainFrame() && | 715 if (render_frame_host->frame_tree_node()->IsMainFrame() && |
716 render_frame_host->render_view_host()->ref_count() <= 1) { | 716 render_frame_host->render_view_host()->ref_count() <= 1) { |
717 render_frame_host->render_view_host()->set_pending_deletion(); | 717 render_frame_host->render_view_host()->set_pending_deletion(); |
718 } | 718 } |
719 | 719 |
720 // |render_frame_host| will be deleted when its SwapOut ACK is received, or | 720 // |render_frame_host| will be deleted when its SwapOut ACK is received, or |
721 // when the timer times out, or when the RFHM itself is deleted (whichever | 721 // when the timer times out, or when the RFHM itself is deleted (whichever |
722 // comes first). | 722 // comes first). |
723 pending_delete_hosts_.push_back( | 723 pending_delete_hosts_.push_back(std::move(render_frame_host)); |
724 linked_ptr<RenderFrameHostImpl>(render_frame_host.release())); | |
725 } | 724 } |
726 | 725 |
727 bool RenderFrameHostManager::IsPendingDeletion( | 726 bool RenderFrameHostManager::IsPendingDeletion( |
728 RenderFrameHostImpl* render_frame_host) { | 727 RenderFrameHostImpl* render_frame_host) { |
729 for (const auto& rfh : pending_delete_hosts_) { | 728 for (const auto& rfh : pending_delete_hosts_) { |
730 if (rfh == render_frame_host) | 729 if (rfh.get() == render_frame_host) |
731 return true; | 730 return true; |
732 } | 731 } |
733 return false; | 732 return false; |
734 } | 733 } |
735 | 734 |
736 bool RenderFrameHostManager::DeleteFromPendingList( | 735 bool RenderFrameHostManager::DeleteFromPendingList( |
737 RenderFrameHostImpl* render_frame_host) { | 736 RenderFrameHostImpl* render_frame_host) { |
738 for (RFHPendingDeleteList::iterator iter = pending_delete_hosts_.begin(); | 737 for (RFHPendingDeleteList::iterator iter = pending_delete_hosts_.begin(); |
739 iter != pending_delete_hosts_.end(); | 738 iter != pending_delete_hosts_.end(); |
740 iter++) { | 739 iter++) { |
741 if (*iter == render_frame_host) { | 740 if (iter->get() == render_frame_host) { |
742 pending_delete_hosts_.erase(iter); | 741 pending_delete_hosts_.erase(iter); |
743 return true; | 742 return true; |
744 } | 743 } |
745 } | 744 } |
746 return false; | 745 return false; |
747 } | 746 } |
748 | 747 |
749 void RenderFrameHostManager::ResetProxyHosts() { | 748 void RenderFrameHostManager::ResetProxyHosts() { |
750 for (auto& pair : proxy_hosts_) { | 749 for (auto& pair : proxy_hosts_) { |
751 static_cast<SiteInstanceImpl*>(pair.second->GetSiteInstance()) | 750 static_cast<SiteInstanceImpl*>(pair.second->GetSiteInstance()) |
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2458 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2457 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2459 if (!frame_tree_node_->opener()) | 2458 if (!frame_tree_node_->opener()) |
2460 return MSG_ROUTING_NONE; | 2459 return MSG_ROUTING_NONE; |
2461 | 2460 |
2462 return frame_tree_node_->opener() | 2461 return frame_tree_node_->opener() |
2463 ->render_manager() | 2462 ->render_manager() |
2464 ->GetRoutingIdForSiteInstance(instance); | 2463 ->GetRoutingIdForSiteInstance(instance); |
2465 } | 2464 } |
2466 | 2465 |
2467 } // namespace content | 2466 } // namespace content |
OLD | NEW |