| 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/navigation_entry_impl.h" | 5 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return base::WrapUnique( | 124 return base::WrapUnique( |
| 125 new NavigationEntryImpl::TreeNode(frame_navigation_entry)); | 125 new NavigationEntryImpl::TreeNode(frame_navigation_entry)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Clone the tree using a copy of the FrameNavigationEntry, without sharing. | 128 // Clone the tree using a copy of the FrameNavigationEntry, without sharing. |
| 129 // TODO(creis): Share FNEs unless it's for another tab. | 129 // TODO(creis): Share FNEs unless it's for another tab. |
| 130 std::unique_ptr<NavigationEntryImpl::TreeNode> copy( | 130 std::unique_ptr<NavigationEntryImpl::TreeNode> copy( |
| 131 new NavigationEntryImpl::TreeNode(frame_entry->Clone())); | 131 new NavigationEntryImpl::TreeNode(frame_entry->Clone())); |
| 132 | 132 |
| 133 // Recursively clone the children. | 133 // Recursively clone the children. |
| 134 for (auto& child : children) { | 134 for (auto* child : children) { |
| 135 copy->children.push_back( | 135 copy->children.push_back( |
| 136 child->CloneAndReplace(frame_tree_node, frame_navigation_entry, false)); | 136 child->CloneAndReplace(frame_tree_node, frame_navigation_entry, false)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 return copy; | 139 return copy; |
| 140 } | 140 } |
| 141 | 141 |
| 142 std::unique_ptr<NavigationEntry> NavigationEntry::Create() { | 142 std::unique_ptr<NavigationEntry> NavigationEntry::Create() { |
| 143 return base::WrapUnique(new NavigationEntryImpl()); | 143 return base::WrapUnique(new NavigationEntryImpl()); |
| 144 } | 144 } |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 NavigationEntryImpl::TreeNode* node = nullptr; | 769 NavigationEntryImpl::TreeNode* node = nullptr; |
| 770 std::queue<NavigationEntryImpl::TreeNode*> work_queue; | 770 std::queue<NavigationEntryImpl::TreeNode*> work_queue; |
| 771 work_queue.push(root_node()); | 771 work_queue.push(root_node()); |
| 772 while (!work_queue.empty()) { | 772 while (!work_queue.empty()) { |
| 773 node = work_queue.front(); | 773 node = work_queue.front(); |
| 774 work_queue.pop(); | 774 work_queue.pop(); |
| 775 if (node->MatchesFrame(frame_tree_node, node == root_node())) | 775 if (node->MatchesFrame(frame_tree_node, node == root_node())) |
| 776 return node; | 776 return node; |
| 777 | 777 |
| 778 // Enqueue any children and keep looking. | 778 // Enqueue any children and keep looking. |
| 779 for (auto& child : node->children) | 779 for (auto* child : node->children) |
| 780 work_queue.push(child); | 780 work_queue.push(child); |
| 781 } | 781 } |
| 782 return nullptr; | 782 return nullptr; |
| 783 } | 783 } |
| 784 | 784 |
| 785 } // namespace content | 785 } // namespace content |
| OLD | NEW |