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

Unified Diff: ui/base/models/tree_node_model.h

Issue 1619733003: ui/base/models: rewrite TreeNode without using ScopedVector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: content_settings fix Created 4 years, 11 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 | « chrome/browser/ui/content_settings/content_setting_image_model.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/models/tree_node_model.h
diff --git a/ui/base/models/tree_node_model.h b/ui/base/models/tree_node_model.h
index 9606dc8119c5b9e71233f49d4a9f9265197efa98..279667b2a406d7f2bbeb507299b9763f3470875c 100644
--- a/ui/base/models/tree_node_model.h
+++ b/ui/base/models/tree_node_model.h
@@ -10,12 +10,11 @@
#include <algorithm>
#include <vector>
-#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
-#include "base/memory/scoped_vector.h"
#include "base/observer_list.h"
+#include "base/stl_util.h"
#include "base/strings/string16.h"
#include "ui/base/models/tree_model.h"
@@ -70,7 +69,9 @@ class TreeNode : public TreeModelNode {
explicit TreeNode(const base::string16& title)
: title_(title), parent_(NULL) {}
- ~TreeNode() override {}
+ ~TreeNode() override {
+ STLDeleteElements(&children_);
+ }
// Adds |node| as a child of this node, at |index|.
virtual void Add(NodeType* node, int index) {
@@ -92,7 +93,7 @@ class TreeNode : public TreeModelNode {
std::find(children_.begin(), children_.end(), node);
DCHECK(i != children_.end());
node->parent_ = NULL;
- children_.weak_erase(i);
+ children_.erase(i);
return node;
}
@@ -100,7 +101,7 @@ class TreeNode : public TreeModelNode {
void RemoveAll() {
for (size_t i = 0; i < children_.size(); ++i)
children_[i]->parent_ = NULL;
- children_.weak_clear();
+ children_.clear();
}
// Removes all existing children without deleting the nodes and adds all nodes
@@ -169,7 +170,7 @@ class TreeNode : public TreeModelNode {
}
protected:
- std::vector<NodeType*>& children() { return children_.get(); }
+ std::vector<NodeType*>& children() { return children_; }
private:
// Title displayed in the tree.
@@ -179,7 +180,7 @@ class TreeNode : public TreeModelNode {
NodeType* parent_;
// This node's children.
- ScopedVector<NodeType> children_;
+ std::vector<NodeType*> children_;
DISALLOW_COPY_AND_ASSIGN(TreeNode);
};
« no previous file with comments | « chrome/browser/ui/content_settings/content_setting_image_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698