| 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/frame_tree_node.h" | 5 #include "content/browser/frame_host/frame_tree_node.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 scoped_ptr<FrameTreeNode> node_to_delete(*iter); | 81 scoped_ptr<FrameTreeNode> node_to_delete(*iter); |
| 82 children_.weak_erase(iter); | 82 children_.weak_erase(iter); |
| 83 node_to_delete->set_parent(NULL); | 83 node_to_delete->set_parent(NULL); |
| 84 node_to_delete.reset(); | 84 node_to_delete.reset(); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 void FrameTreeNode::ResetForNewProcess() { | 88 void FrameTreeNode::ResetForNewProcess() { |
| 89 current_url_ = GURL(); | 89 current_url_ = GURL(); |
| 90 | 90 |
| 91 // The RenderFrame no longer exists and will need to be created again. | |
| 92 current_frame_host()->SetRenderFrameCreated(false); | |
| 93 | |
| 94 // The children may not have been cleared if a cross-process navigation | 91 // The children may not have been cleared if a cross-process navigation |
| 95 // commits before the old process cleans everything up. Make sure the child | 92 // commits before the old process cleans everything up. Make sure the child |
| 96 // nodes get deleted before swapping to a new process. | 93 // nodes get deleted before swapping to a new process. |
| 97 ScopedVector<FrameTreeNode> old_children = children_.Pass(); | 94 ScopedVector<FrameTreeNode> old_children = children_.Pass(); |
| 98 old_children.clear(); // May notify observers. | 95 old_children.clear(); // May notify observers. |
| 99 } | 96 } |
| 100 | 97 |
| 101 bool FrameTreeNode::IsDescendantOf(FrameTreeNode* other) const { | 98 bool FrameTreeNode::IsDescendantOf(FrameTreeNode* other) const { |
| 102 if (!other || !other->child_count()) | 99 if (!other || !other->child_count()) |
| 103 return false; | 100 return false; |
| 104 | 101 |
| 105 for (FrameTreeNode* node = parent(); node; node = node->parent()) { | 102 for (FrameTreeNode* node = parent(); node; node = node->parent()) { |
| 106 if (node == other) | 103 if (node == other) |
| 107 return true; | 104 return true; |
| 108 } | 105 } |
| 109 | 106 |
| 110 return false; | 107 return false; |
| 111 } | 108 } |
| 112 | 109 |
| 113 } // namespace content | 110 } // namespace content |
| OLD | NEW |