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 de6c69b59bd06e46c839dbcff6e67ef7012d55b7..e22e720f171bdca144f5708feecb1dc7f98bc898 100644 |
--- a/content/browser/frame_host/frame_tree.cc |
+++ b/content/browser/frame_host/frame_tree.cc |
@@ -65,13 +65,8 @@ bool ResetNodesForNewProcess(RenderViewHost* render_view_host, |
return true; |
} |
-bool CreateProxyForSiteInstance(FrameTreeNode* source_node, |
- const scoped_refptr<SiteInstance>& instance, |
+bool CreateProxyForSiteInstance(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.get()); |
return true; |
} |
@@ -142,6 +137,26 @@ void FrameTree::ForEach( |
} |
} |
+void FrameTree::ForEach( |
+ const base::Callback<bool(FrameTreeNode*)>& on_node, |
+ FrameTreeNode* skip_node) const { |
+ std::queue<FrameTreeNode*> queue; |
+ queue.push(root_.get()); |
+ |
+ while (!queue.empty()) { |
+ FrameTreeNode* node = queue.front(); |
+ queue.pop(); |
+ if (skip_node == node) |
+ continue; |
+ |
+ if (!on_node.Run(node)) |
+ break; |
+ |
+ for (size_t i = 0; i < node->child_count(); ++i) |
+ queue.push(node->child_at(i)); |
+ } |
+} |
+ |
RenderFrameHostImpl* FrameTree::AddFrame(FrameTreeNode* parent, |
int new_routing_id, |
const std::string& frame_name) { |
@@ -193,7 +208,12 @@ void FrameTree::CreateProxiesForSiteInstance( |
} |
scoped_refptr<SiteInstance> instance(site_instance); |
- ForEach(base::Bind(&CreateProxyForSiteInstance, source, instance)); |
+ |
+ // When creating proxies in the FrameTree, it is in reponse to a node |
awong
2014/09/03 21:58:38
"Proxies are created in the FrameTree in response
nasko
2014/09/03 23:50:19
Done.
|
+ // navigating to a new SiteInstance. Since that node's navigation will replace |
awong
2014/09/03 21:58:38
"this nodes" -> |source|'s
nasko
2014/09/03 23:50:19
Done.
|
+ // the currently loaded document, the entire subtree under the node will be |
awong
2014/09/03 21:58:38
the node -> |source|
nasko
2014/09/03 23:50:19
Done.
|
+ // removed. |
+ ForEach(base::Bind(&CreateProxyForSiteInstance, instance), source); |
} |
void FrameTree::ResetForMainFrameSwap() { |