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 2286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2297 } | 2297 } |
2298 if (old_render_frame_host) { | 2298 if (old_render_frame_host) { |
2299 old_render_frame_host->GetSiteInstance()-> | 2299 old_render_frame_host->GetSiteInstance()-> |
2300 DecrementRelatedActiveContentsCount(); | 2300 DecrementRelatedActiveContentsCount(); |
2301 } | 2301 } |
2302 } | 2302 } |
2303 | 2303 |
2304 return old_render_frame_host; | 2304 return old_render_frame_host; |
2305 } | 2305 } |
2306 | 2306 |
2307 bool RenderFrameHostManager::IsRVHOnSwappedOutList( | |
2308 RenderViewHostImpl* rvh) const { | |
2309 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(rvh->GetSiteInstance()); | |
2310 if (!proxy) | |
2311 return false; | |
2312 // If there is a proxy without RFH, it is for a subframe in the SiteInstance | |
2313 // of |rvh|. Subframes should be ignored in this case. | |
2314 if (!proxy->render_frame_host()) | |
2315 return false; | |
2316 return IsOnSwappedOutList(proxy->render_frame_host()); | |
2317 } | |
2318 | |
2319 bool RenderFrameHostManager::IsOnSwappedOutList( | |
2320 RenderFrameHostImpl* rfh) const { | |
2321 if (!rfh->GetSiteInstance()) | |
2322 return false; | |
2323 | |
2324 RenderFrameProxyHost* host = GetRenderFrameProxyHost(rfh->GetSiteInstance()); | |
2325 if (!host) | |
2326 return false; | |
2327 | |
2328 return host->render_frame_host() == rfh; | |
2329 } | |
2330 | |
2331 RenderViewHostImpl* RenderFrameHostManager::GetSwappedOutRenderViewHost( | 2307 RenderViewHostImpl* RenderFrameHostManager::GetSwappedOutRenderViewHost( |
2332 SiteInstance* instance) const { | 2308 SiteInstance* instance) const { |
2333 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); | 2309 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); |
2334 if (proxy) | 2310 if (proxy) |
2335 return proxy->GetRenderViewHost(); | 2311 return proxy->GetRenderViewHost(); |
2336 return nullptr; | 2312 return nullptr; |
2337 } | 2313 } |
2338 | 2314 |
2339 RenderFrameProxyHost* RenderFrameHostManager::GetRenderFrameProxyHost( | 2315 RenderFrameProxyHost* RenderFrameHostManager::GetRenderFrameProxyHost( |
2340 SiteInstance* instance) const { | 2316 SiteInstance* instance) const { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2565 resolved_url)) { | 2541 resolved_url)) { |
2566 DCHECK(!dest_instance || | 2542 DCHECK(!dest_instance || |
2567 dest_instance == render_frame_host_->GetSiteInstance()); | 2543 dest_instance == render_frame_host_->GetSiteInstance()); |
2568 return false; | 2544 return false; |
2569 } | 2545 } |
2570 | 2546 |
2571 return true; | 2547 return true; |
2572 } | 2548 } |
2573 | 2549 |
2574 } // namespace content | 2550 } // namespace content |
OLD | NEW |