Index: content/browser/frame_host/frame_tree.cc |
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc |
index 28d98e7620479bc49265e6e46d1890870b37201b..cab88ab2b6aa6a8b2830fe0bf2938e9c7b297b57 100644 |
--- a/content/browser/frame_host/frame_tree.cc |
+++ b/content/browser/frame_host/frame_tree.cc |
@@ -54,6 +54,17 @@ bool ResetNodesForNewProcess(RenderViewHost* render_view_host, |
return true; |
} |
+bool CreateProxyForSiteInstance(FrameTreeNode* source_node, |
+ const scoped_refptr<SiteInstance>& instance, |
+ FrameTreeNode* node) { |
+ // Skip the node that initiated the creation. |
+ if (source_node == node) |
+ return true; |
+ |
+ node->render_manager()->CreateRenderFrameProxy(instance); |
+ return true; |
+} |
+ |
} // namespace |
FrameTree::FrameTree(Navigator* navigator, |
@@ -135,6 +146,12 @@ void FrameTree::RemoveFrame(FrameTreeNode* child) { |
parent->RemoveChild(child); |
} |
+void FrameTree::CreateProxiesForSiteInstance( |
+ FrameTreeNode* source, |
+ const scoped_refptr<SiteInstance>& site_instance) { |
+ ForEach(base::Bind(&CreateProxyForSiteInstance, source, site_instance)); |
+} |
+ |
void FrameTree::ResetForMainFrameSwap() { |
root_->ResetForNewProcess(); |
focused_frame_tree_node_id_ = -1; |
@@ -167,25 +184,27 @@ void FrameTree::SetFrameRemoveListener( |
on_frame_removed_ = on_frame_removed; |
} |
-RenderViewHostImpl* FrameTree::CreateRenderViewHostForMainFrame( |
- SiteInstance* site_instance, |
- int routing_id, |
- int main_frame_routing_id, |
- bool swapped_out, |
- bool hidden) { |
+RenderViewHostImpl* FrameTree::CreateRenderViewHost(SiteInstance* site_instance, |
+ int routing_id, |
+ int main_frame_routing_id, |
+ bool swapped_out, |
+ bool hidden) { |
DCHECK(main_frame_routing_id != MSG_ROUTING_NONE); |
RenderViewHostMap::iterator iter = |
render_view_host_map_.find(site_instance->GetId()); |
if (iter != render_view_host_map_.end()) { |
// If a RenderViewHost is pending shutdown for this |site_instance|, put it |
- // in the map of RenderViewHosts pending shutdown. Otherwise there should |
- // not be a RenderViewHost for the SiteInstance. |
- CHECK_EQ(RenderViewHostImpl::STATE_PENDING_SHUTDOWN, |
- iter->second->rvh_state()); |
- render_view_host_pending_shutdown_map_.insert( |
- std::pair<int, RenderViewHostImpl*>(site_instance->GetId(), |
- iter->second)); |
- render_view_host_map_.erase(iter); |
+ // in the map of RenderViewHosts pending shutdown. Otherwise return the |
+ // existing RenderViewHost for the SiteInstance. |
+ if (iter->second->rvh_state() == |
+ RenderViewHostImpl::STATE_PENDING_SHUTDOWN) { |
+ render_view_host_pending_shutdown_map_.insert( |
+ std::pair<int, RenderViewHostImpl*>(site_instance->GetId(), |
+ iter->second)); |
+ render_view_host_map_.erase(iter); |
+ } else { |
+ return iter->second; |
+ } |
} |
RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
RenderViewHostFactory::Create(site_instance, |
@@ -200,8 +219,7 @@ RenderViewHostImpl* FrameTree::CreateRenderViewHostForMainFrame( |
return rvh; |
} |
-RenderViewHostImpl* FrameTree::GetRenderViewHostForSubFrame( |
- SiteInstance* site_instance) { |
+RenderViewHostImpl* FrameTree::GetRenderViewHost(SiteInstance* site_instance) { |
RenderViewHostMap::iterator iter = |
render_view_host_map_.find(site_instance->GetId()); |
// TODO(creis): Mirror the frame tree so this check can't fail. |