Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1312643002: Plumb opener information when creating RenderFrames and RenderFrameProxies for subframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@opener-CreateOpenerProxiesIfNeeded
Patch Set: Fix param ordering in RenderThreadImpl::OnCreateNewFrameProxy Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 return delegate_->CreateRenderViewForRenderManager( 1967 return delegate_->CreateRenderViewForRenderManager(
1968 render_view_host, opener_frame_routing_id, proxy_routing_id, 1968 render_view_host, opener_frame_routing_id, proxy_routing_id,
1969 frame_tree_node_->current_replication_state(), for_main_frame_navigation); 1969 frame_tree_node_->current_replication_state(), for_main_frame_navigation);
1970 } 1970 }
1971 1971
1972 bool RenderFrameHostManager::InitRenderFrame( 1972 bool RenderFrameHostManager::InitRenderFrame(
1973 RenderFrameHostImpl* render_frame_host) { 1973 RenderFrameHostImpl* render_frame_host) {
1974 if (render_frame_host->IsRenderFrameLive()) 1974 if (render_frame_host->IsRenderFrameLive())
1975 return true; 1975 return true;
1976 1976
1977 SiteInstance* site_instance = render_frame_host->GetSiteInstance();
1978
1979 int opener_routing_id = MSG_ROUTING_NONE;
1980 if (frame_tree_node_->opener())
1981 opener_routing_id = GetOpenerRoutingID(site_instance);
1982
1977 int parent_routing_id = MSG_ROUTING_NONE; 1983 int parent_routing_id = MSG_ROUTING_NONE;
1978 int previous_sibling_routing_id = MSG_ROUTING_NONE;
1979 int proxy_routing_id = MSG_ROUTING_NONE;
1980
1981 if (frame_tree_node_->parent()) { 1984 if (frame_tree_node_->parent()) {
1982 parent_routing_id = frame_tree_node_->parent()->render_manager()-> 1985 parent_routing_id = frame_tree_node_->parent()
1983 GetRoutingIdForSiteInstance(render_frame_host->GetSiteInstance()); 1986 ->render_manager()
1987 ->GetRoutingIdForSiteInstance(site_instance);
1984 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE); 1988 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE);
1985 } 1989 }
1986 1990
1987 // At this point, all RenderFrameProxies for sibling frames have already been 1991 // At this point, all RenderFrameProxies for sibling frames have already been
1988 // created, including any proxies that come after this frame. To preserve 1992 // created, including any proxies that come after this frame. To preserve
1989 // correct order for indexed window access (e.g., window.frames[1]), pass the 1993 // correct order for indexed window access (e.g., window.frames[1]), pass the
1990 // previous sibling frame so that this frame is correctly inserted into the 1994 // previous sibling frame so that this frame is correctly inserted into the
1991 // frame tree on the renderer side. 1995 // frame tree on the renderer side.
1996 int previous_sibling_routing_id = MSG_ROUTING_NONE;
1992 FrameTreeNode* previous_sibling = frame_tree_node_->PreviousSibling(); 1997 FrameTreeNode* previous_sibling = frame_tree_node_->PreviousSibling();
1993 if (previous_sibling) { 1998 if (previous_sibling) {
1994 previous_sibling_routing_id = 1999 previous_sibling_routing_id =
1995 previous_sibling->render_manager()->GetRoutingIdForSiteInstance( 2000 previous_sibling->render_manager()->GetRoutingIdForSiteInstance(
1996 render_frame_host->GetSiteInstance()); 2001 site_instance);
1997 CHECK_NE(previous_sibling_routing_id, MSG_ROUTING_NONE); 2002 CHECK_NE(previous_sibling_routing_id, MSG_ROUTING_NONE);
1998 } 2003 }
1999 2004
2000 // Check whether there is an existing proxy for this frame in this 2005 // Check whether there is an existing proxy for this frame in this
2001 // SiteInstance. If there is, the new RenderFrame needs to be able to find 2006 // SiteInstance. If there is, the new RenderFrame needs to be able to find
2002 // the proxy it is replacing, so that it can fully initialize itself. 2007 // the proxy it is replacing, so that it can fully initialize itself.
2003 // NOTE: This is the only time that a RenderFrameProxyHost can be in the same 2008 // NOTE: This is the only time that a RenderFrameProxyHost can be in the same
2004 // SiteInstance as its RenderFrameHost. This is only the case until the 2009 // SiteInstance as its RenderFrameHost. This is only the case until the
2005 // RenderFrameHost commits, at which point it will replace and delete the 2010 // RenderFrameHost commits, at which point it will replace and delete the
2006 // RenderFrameProxyHost. 2011 // RenderFrameProxyHost.
2007 RenderFrameProxyHost* existing_proxy = 2012 int proxy_routing_id = MSG_ROUTING_NONE;
2008 GetRenderFrameProxyHost(render_frame_host->GetSiteInstance()); 2013 RenderFrameProxyHost* existing_proxy = GetRenderFrameProxyHost(site_instance);
2009 if (existing_proxy) { 2014 if (existing_proxy) {
2010 proxy_routing_id = existing_proxy->GetRoutingID(); 2015 proxy_routing_id = existing_proxy->GetRoutingID();
2011 CHECK_NE(proxy_routing_id, MSG_ROUTING_NONE); 2016 CHECK_NE(proxy_routing_id, MSG_ROUTING_NONE);
2012 if (!existing_proxy->is_render_frame_proxy_live()) 2017 if (!existing_proxy->is_render_frame_proxy_live())
2013 existing_proxy->InitRenderFrameProxy(); 2018 existing_proxy->InitRenderFrameProxy();
2014 } 2019 }
2020
2015 return delegate_->CreateRenderFrameForRenderManager( 2021 return delegate_->CreateRenderFrameForRenderManager(
2016 render_frame_host, parent_routing_id, previous_sibling_routing_id, 2022 render_frame_host, proxy_routing_id, opener_routing_id, parent_routing_id,
2017 proxy_routing_id); 2023 previous_sibling_routing_id);
2018 } 2024 }
2019 2025
2020 int RenderFrameHostManager::GetRoutingIdForSiteInstance( 2026 int RenderFrameHostManager::GetRoutingIdForSiteInstance(
2021 SiteInstance* site_instance) { 2027 SiteInstance* site_instance) {
2022 if (render_frame_host_->GetSiteInstance() == site_instance) 2028 if (render_frame_host_->GetSiteInstance() == site_instance)
2023 return render_frame_host_->GetRoutingID(); 2029 return render_frame_host_->GetRoutingID();
2024 2030
2025 // If there is a matching pending RFH, only return it if swapped out is 2031 // If there is a matching pending RFH, only return it if swapped out is
2026 // allowed, since otherwise there should be a proxy that should be used 2032 // allowed, since otherwise there should be a proxy that should be used
2027 // instead. 2033 // instead.
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { 2575 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
2570 if (!frame_tree_node_->opener()) 2576 if (!frame_tree_node_->opener())
2571 return MSG_ROUTING_NONE; 2577 return MSG_ROUTING_NONE;
2572 2578
2573 return frame_tree_node_->opener() 2579 return frame_tree_node_->opener()
2574 ->render_manager() 2580 ->render_manager()
2575 ->GetRoutingIdForSiteInstance(instance); 2581 ->GetRoutingIdForSiteInstance(instance);
2576 } 2582 }
2577 2583
2578 } // namespace content 2584 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.h ('k') | content/browser/frame_host/render_frame_proxy_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698