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

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: 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 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..5470097115c991b33728e82934c6f95c877c82ec 100644
--- a/base/memory/scoped_vector.h
+++ b/base/memory/scoped_vector.h
@@ -33,7 +33,7 @@ class ScopedVector {
const_reverse_iterator;
ScopedVector() {}
- ~ScopedVector() { reset(); }
+ ~ScopedVector() { clear(); }
ScopedVector(RValue& other) { swap(other); }
ScopedVector& operator=(RValue& rhs) {
@@ -73,7 +73,6 @@ class ScopedVector {
v.clear();
}
- void reset() { STLDeleteElements(&v); }
void reserve(size_t capacity) { v.reserve(capacity); }
void resize(size_t new_size) { v.resize(new_size); }
@@ -82,7 +81,10 @@ class ScopedVector {
v.assign(begin, end);
}
- void clear() { v.clear(); }
+ void clear() { STLDeleteElements(&v); }
+
+ // 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