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

Side by Side Diff: ui/base/models/tree_node_model.h

Issue 10797017: base: Make ScopedVector::clear() destroy elements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update location_bar_view_mac.mm Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/models/list_model.h ('k') | ui/gfx/render_text_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef UI_BASE_MODELS_TREE_NODE_MODEL_H_ 5 #ifndef UI_BASE_MODELS_TREE_NODE_MODEL_H_
6 #define UI_BASE_MODELS_TREE_NODE_MODEL_H_ 6 #define UI_BASE_MODELS_TREE_NODE_MODEL_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 DCHECK(i != children_.end()); 91 DCHECK(i != children_.end());
92 node->parent_ = NULL; 92 node->parent_ = NULL;
93 children_.weak_erase(i); 93 children_.weak_erase(i);
94 return node; 94 return node;
95 } 95 }
96 96
97 // Removes all the children from this node. This does NOT delete the nodes. 97 // Removes all the children from this node. This does NOT delete the nodes.
98 void RemoveAll() { 98 void RemoveAll() {
99 for (size_t i = 0; i < children_.size(); ++i) 99 for (size_t i = 0; i < children_.size(); ++i)
100 children_[i]->parent_ = NULL; 100 children_[i]->parent_ = NULL;
101 children_.clear(); 101 children_.weak_clear();
102 } 102 }
103 103
104 // Returns the parent node, or NULL if this is the root node. 104 // Returns the parent node, or NULL if this is the root node.
105 const NodeType* parent() const { return parent_; } 105 const NodeType* parent() const { return parent_; }
106 NodeType* parent() { return parent_; } 106 NodeType* parent() { return parent_; }
107 107
108 // Returns true if this is the root node. 108 // Returns true if this is the root node.
109 bool is_root() const { return parent_ == NULL; } 109 bool is_root() const { return parent_ == NULL; }
110 110
111 // Returns the number of children. 111 // Returns the number of children.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 // The root. 288 // The root.
289 scoped_ptr<NodeType> root_; 289 scoped_ptr<NodeType> root_;
290 290
291 DISALLOW_COPY_AND_ASSIGN(TreeNodeModel); 291 DISALLOW_COPY_AND_ASSIGN(TreeNodeModel);
292 }; 292 };
293 293
294 } // namespace ui 294 } // namespace ui
295 295
296 #endif // UI_BASE_MODELS_TREE_NODE_MODEL_H_ 296 #endif // UI_BASE_MODELS_TREE_NODE_MODEL_H_
OLDNEW
« no previous file with comments | « ui/base/models/list_model.h ('k') | ui/gfx/render_text_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698