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

Unified Diff: content/browser/frame_host/frame_tree_node.cc

Issue 917793006: Resetting FrameTreeNode must remove child FrameTreeNodes from global map. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/frame_tree_node.cc
diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc
index 6d654aaa9007b084411932f0176b241770ba63e4..845aecea62afc5945311f283f029c8d8b6504682 100644
--- a/content/browser/frame_host/frame_tree_node.cc
+++ b/content/browser/frame_host/frame_tree_node.cc
@@ -92,6 +92,14 @@ void FrameTreeNode::ResetForNewProcess() {
// commits before the old process cleans everything up. Make sure the child
// nodes get deleted before swapping to a new process.
ScopedVector<FrameTreeNode> old_children = children_.Pass();
+
+ // Loop over all children removing them from the FrameTree. This will ensure
+ // that nodes are properly removed from the tree and notifications are sent.
+ // Note: since the |children_| vector is now empty, the calls into RemoveChild
+ // will be a noop and will not result in repeatedly traversing the list.
+ for (const auto& child : old_children)
+ frame_tree_->RemoveFrame(child);
+
old_children.clear(); // May notify observers.
}
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698