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

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

Issue 1113393004: OOPIF: Specify previous sibling frames when creating new RenderFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TODOs and fix comment Created 5 years, 7 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 <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 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 proxy_routing_id, 1644 proxy_routing_id,
1645 for_main_frame_navigation); 1645 for_main_frame_navigation);
1646 } 1646 }
1647 1647
1648 bool RenderFrameHostManager::InitRenderFrame( 1648 bool RenderFrameHostManager::InitRenderFrame(
1649 RenderFrameHostImpl* render_frame_host) { 1649 RenderFrameHostImpl* render_frame_host) {
1650 if (render_frame_host->IsRenderFrameLive()) 1650 if (render_frame_host->IsRenderFrameLive())
1651 return true; 1651 return true;
1652 1652
1653 int parent_routing_id = MSG_ROUTING_NONE; 1653 int parent_routing_id = MSG_ROUTING_NONE;
1654 int previous_sibling_routing_id = MSG_ROUTING_NONE;
1654 int proxy_routing_id = MSG_ROUTING_NONE; 1655 int proxy_routing_id = MSG_ROUTING_NONE;
1656
1655 if (frame_tree_node_->parent()) { 1657 if (frame_tree_node_->parent()) {
1656 parent_routing_id = frame_tree_node_->parent()->render_manager()-> 1658 parent_routing_id = frame_tree_node_->parent()->render_manager()->
1657 GetRoutingIdForSiteInstance(render_frame_host->GetSiteInstance()); 1659 GetRoutingIdForSiteInstance(render_frame_host->GetSiteInstance());
1658 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE); 1660 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE);
1659 } 1661 }
1662
1663 // At this point, all RenderFrameProxies for sibling frames have already been
1664 // created, including any proxies that come after this frame. To preserve
1665 // correct order for indexed window access (e.g., window.frames[1]), pass the
1666 // previous sibling frame so that this frame is correctly inserted into the
1667 // frame tree on the renderer side.
1668 FrameTreeNode* previous_sibling = frame_tree_node_->PreviousSibling();
1669 if (previous_sibling) {
1670 previous_sibling_routing_id =
1671 previous_sibling->render_manager()->GetRoutingIdForSiteInstance(
1672 render_frame_host->GetSiteInstance());
1673 CHECK_NE(previous_sibling_routing_id, MSG_ROUTING_NONE);
1674 }
1675
1660 // Check whether there is an existing proxy for this frame in this 1676 // Check whether there is an existing proxy for this frame in this
1661 // SiteInstance. If there is, the new RenderFrame needs to be able to find 1677 // SiteInstance. If there is, the new RenderFrame needs to be able to find
1662 // the proxy it is replacing, so that it can fully initialize itself. 1678 // the proxy it is replacing, so that it can fully initialize itself.
1663 // NOTE: This is the only time that a RenderFrameProxyHost can be in the same 1679 // NOTE: This is the only time that a RenderFrameProxyHost can be in the same
1664 // SiteInstance as its RenderFrameHost. This is only the case until the 1680 // SiteInstance as its RenderFrameHost. This is only the case until the
1665 // RenderFrameHost commits, at which point it will replace and delete the 1681 // RenderFrameHost commits, at which point it will replace and delete the
1666 // RenderFrameProxyHost. 1682 // RenderFrameProxyHost.
1667 RenderFrameProxyHost* existing_proxy = 1683 RenderFrameProxyHost* existing_proxy =
1668 GetRenderFrameProxyHost(render_frame_host->GetSiteInstance()); 1684 GetRenderFrameProxyHost(render_frame_host->GetSiteInstance());
1669 if (existing_proxy) { 1685 if (existing_proxy) {
1670 proxy_routing_id = existing_proxy->GetRoutingID(); 1686 proxy_routing_id = existing_proxy->GetRoutingID();
1671 CHECK_NE(proxy_routing_id, MSG_ROUTING_NONE); 1687 CHECK_NE(proxy_routing_id, MSG_ROUTING_NONE);
1672 if (!existing_proxy->is_render_frame_proxy_live()) 1688 if (!existing_proxy->is_render_frame_proxy_live())
1673 existing_proxy->InitRenderFrameProxy(); 1689 existing_proxy->InitRenderFrameProxy();
1674 } 1690 }
1675 return delegate_->CreateRenderFrameForRenderManager(render_frame_host, 1691 return delegate_->CreateRenderFrameForRenderManager(
1676 parent_routing_id, 1692 render_frame_host, parent_routing_id, previous_sibling_routing_id,
1677 proxy_routing_id); 1693 proxy_routing_id);
1678 } 1694 }
1679 1695
1680 int RenderFrameHostManager::GetRoutingIdForSiteInstance( 1696 int RenderFrameHostManager::GetRoutingIdForSiteInstance(
1681 SiteInstance* site_instance) { 1697 SiteInstance* site_instance) {
1682 if (render_frame_host_->GetSiteInstance() == site_instance) 1698 if (render_frame_host_->GetSiteInstance() == site_instance)
1683 return render_frame_host_->GetRoutingID(); 1699 return render_frame_host_->GetRoutingID();
1684 1700
1685 RenderFrameProxyHostMap::iterator iter = 1701 RenderFrameProxyHostMap::iterator iter =
1686 proxy_hosts_.find(site_instance->GetId()); 1702 proxy_hosts_.find(site_instance->GetId());
1687 if (iter != proxy_hosts_.end()) 1703 if (iter != proxy_hosts_.end())
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 void RenderFrameHostManager::DeleteRenderFrameProxyHost( 2118 void RenderFrameHostManager::DeleteRenderFrameProxyHost(
2103 SiteInstance* instance) { 2119 SiteInstance* instance) {
2104 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); 2120 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId());
2105 if (iter != proxy_hosts_.end()) { 2121 if (iter != proxy_hosts_.end()) {
2106 delete iter->second; 2122 delete iter->second;
2107 proxy_hosts_.erase(iter); 2123 proxy_hosts_.erase(iter);
2108 } 2124 }
2109 } 2125 }
2110 2126
2111 } // namespace content 2127 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.h ('k') | content/browser/site_per_process_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698