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

Unified Diff: base/memory/scoped_vector.h

Issue 10797017: base: Make ScopedVector::clear() destroy elements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-add updated clear method and write a test for weak_clear 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/memory/scoped_vector_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/scoped_vector.h
diff --git a/base/memory/scoped_vector.h b/base/memory/scoped_vector.h
index f8afcdd5ee5a7efe1512db41ad0667b7621b1204..8c4eef01b98fedee07dd6275ea8f23ce916644be 100644
--- a/base/memory/scoped_vector.h
+++ b/base/memory/scoped_vector.h
@@ -73,7 +73,7 @@ class ScopedVector {
v.clear();
}
- void reset() { STLDeleteElements(&v); }
+ void reset() { clear(); }
void reserve(size_t capacity) { v.reserve(capacity); }
void resize(size_t new_size) { v.resize(new_size); }
@@ -82,7 +82,10 @@ class ScopedVector {
v.assign(begin, end);
}
- void clear() { v.clear(); }
+ void clear() { STLDeleteElements(&v); }
sky 2012/07/18 21:24:38 Any chance we could get rid of one of reset or cle
Peter Kasting 2012/07/18 21:26:32 (I suggest nuking reset())
+
+ // Like |clear()|, but doesn't delete any elements.
+ void weak_clear() { v.clear(); }
// Lets the ScopedVector take ownership of |x|.
iterator insert(iterator position, T* x) {
« no previous file with comments | « no previous file | base/memory/scoped_vector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698