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 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 point, all RenderFrameProxies for sibling frames have already been | |
nasko
2015/05/04 17:16:55
nit: "At point" - did you mean "At this point"?
alexmos
2015/05/04 21:18:02
Indeed. Thanks for catching!
| |
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 if (FrameTreeNode* previous_sibling = frame_tree_node_->PreviousSibling()) { | |
nasko
2015/05/04 17:16:55
nit: Please separate the variable from the if stat
alexmos
2015/05/04 21:18:02
Done. Apparently, the style guide was recently up
| |
1669 previous_sibling_routing_id = | |
1670 previous_sibling->render_manager()->GetRoutingIdForSiteInstance( | |
1671 render_frame_host->GetSiteInstance()); | |
1672 CHECK_NE(previous_sibling_routing_id, MSG_ROUTING_NONE); | |
1673 } | |
1674 | |
1660 // Check whether there is an existing proxy for this frame in this | 1675 // 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 | 1676 // 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. | 1677 // 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 | 1678 // 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 | 1679 // SiteInstance as its RenderFrameHost. This is only the case until the |
1665 // RenderFrameHost commits, at which point it will replace and delete the | 1680 // RenderFrameHost commits, at which point it will replace and delete the |
1666 // RenderFrameProxyHost. | 1681 // RenderFrameProxyHost. |
1667 RenderFrameProxyHost* existing_proxy = | 1682 RenderFrameProxyHost* existing_proxy = |
1668 GetRenderFrameProxyHost(render_frame_host->GetSiteInstance()); | 1683 GetRenderFrameProxyHost(render_frame_host->GetSiteInstance()); |
1669 if (existing_proxy) { | 1684 if (existing_proxy) { |
1670 proxy_routing_id = existing_proxy->GetRoutingID(); | 1685 proxy_routing_id = existing_proxy->GetRoutingID(); |
1671 CHECK_NE(proxy_routing_id, MSG_ROUTING_NONE); | 1686 CHECK_NE(proxy_routing_id, MSG_ROUTING_NONE); |
1672 if (!existing_proxy->is_render_frame_proxy_live()) | 1687 if (!existing_proxy->is_render_frame_proxy_live()) |
1673 existing_proxy->InitRenderFrameProxy(); | 1688 existing_proxy->InitRenderFrameProxy(); |
1674 } | 1689 } |
1675 return delegate_->CreateRenderFrameForRenderManager(render_frame_host, | 1690 return delegate_->CreateRenderFrameForRenderManager( |
1676 parent_routing_id, | 1691 render_frame_host, parent_routing_id, previous_sibling_routing_id, |
1677 proxy_routing_id); | 1692 proxy_routing_id); |
1678 } | 1693 } |
1679 | 1694 |
1680 int RenderFrameHostManager::GetRoutingIdForSiteInstance( | 1695 int RenderFrameHostManager::GetRoutingIdForSiteInstance( |
1681 SiteInstance* site_instance) { | 1696 SiteInstance* site_instance) { |
1682 if (render_frame_host_->GetSiteInstance() == site_instance) | 1697 if (render_frame_host_->GetSiteInstance() == site_instance) |
1683 return render_frame_host_->GetRoutingID(); | 1698 return render_frame_host_->GetRoutingID(); |
1684 | 1699 |
1685 RenderFrameProxyHostMap::iterator iter = | 1700 RenderFrameProxyHostMap::iterator iter = |
1686 proxy_hosts_.find(site_instance->GetId()); | 1701 proxy_hosts_.find(site_instance->GetId()); |
1687 if (iter != proxy_hosts_.end()) | 1702 if (iter != proxy_hosts_.end()) |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2102 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 2117 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
2103 SiteInstance* instance) { | 2118 SiteInstance* instance) { |
2104 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 2119 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
2105 if (iter != proxy_hosts_.end()) { | 2120 if (iter != proxy_hosts_.end()) { |
2106 delete iter->second; | 2121 delete iter->second; |
2107 proxy_hosts_.erase(iter); | 2122 proxy_hosts_.erase(iter); |
2108 } | 2123 } |
2109 } | 2124 } |
2110 | 2125 |
2111 } // namespace content | 2126 } // namespace content |
OLD | NEW |