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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 // TODO(carlosk): this code is very similar to what can be found in | 656 // TODO(carlosk): this code is very similar to what can be found in |
657 // SwapOutOldFrame and we should see that these are unified at some point. | 657 // SwapOutOldFrame and we should see that these are unified at some point. |
658 | 658 |
659 // If the SiteInstance for the pending RFH is being used by others don't | 659 // If the SiteInstance for the pending RFH is being used by others don't |
660 // delete the RFH. Just swap it out and it can be reused at a later point. | 660 // delete the RFH. Just swap it out and it can be reused at a later point. |
661 SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance(); | 661 SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance(); |
662 if (site_instance->HasSite() && site_instance->active_frame_count() > 1) { | 662 if (site_instance->HasSite() && site_instance->active_frame_count() > 1) { |
663 // Any currently suspended navigations are no longer needed. | 663 // Any currently suspended navigations are no longer needed. |
664 render_frame_host->CancelSuspendedNavigations(); | 664 render_frame_host->CancelSuspendedNavigations(); |
665 | 665 |
| 666 CHECK(!GetRenderFrameProxyHost(site_instance)); |
666 RenderFrameProxyHost* proxy = | 667 RenderFrameProxyHost* proxy = |
667 new RenderFrameProxyHost(site_instance, frame_tree_node_); | 668 new RenderFrameProxyHost(site_instance, frame_tree_node_); |
668 proxy_hosts_[site_instance->GetId()] = proxy; | 669 proxy_hosts_[site_instance->GetId()] = proxy; |
669 | 670 |
670 // Check if the RenderFrameHost is already swapped out, to avoid swapping it | 671 // Check if the RenderFrameHost is already swapped out, to avoid swapping it |
671 // out again. | 672 // out again. |
672 if (!render_frame_host->is_swapped_out()) | 673 if (!render_frame_host->is_swapped_out()) |
673 render_frame_host->SwapOut(proxy, false); | 674 render_frame_host->SwapOut(proxy, false); |
674 | 675 |
675 if (frame_tree_node_->IsMainFrame()) | 676 if (frame_tree_node_->IsMainFrame()) |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 2085 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
2085 SiteInstance* instance) { | 2086 SiteInstance* instance) { |
2086 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 2087 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
2087 if (iter != proxy_hosts_.end()) { | 2088 if (iter != proxy_hosts_.end()) { |
2088 delete iter->second; | 2089 delete iter->second; |
2089 proxy_hosts_.erase(iter); | 2090 proxy_hosts_.erase(iter); |
2090 } | 2091 } |
2091 } | 2092 } |
2092 | 2093 |
2093 } // namespace content | 2094 } // namespace content |
OLD | NEW |