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

Side by Side Diff: cc/scoped_ptr_vector.h

Issue 11830031: cc: Delete the element being popped in ScopedPtrVector::pop_back() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 CC_SCOPED_PTR_VECTOR_H_ 5 #ifndef CC_SCOPED_PTR_VECTOR_H_
6 #define CC_SCOPED_PTR_VECTOR_H_ 6 #define CC_SCOPED_PTR_VECTOR_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 void clear() { 111 void clear() {
112 STLDeleteElements(&data_); 112 STLDeleteElements(&data_);
113 } 113 }
114 114
115 void push_back(scoped_ptr<T> item) { 115 void push_back(scoped_ptr<T> item) {
116 data_.push_back(item.release()); 116 data_.push_back(item.release());
117 } 117 }
118 118
119 void pop_back() { 119 void pop_back() {
120 delete data_.back();
120 data_.pop_back(); 121 data_.pop_back();
121 } 122 }
122 123
123 void insert(iterator position, scoped_ptr<T> item) { 124 void insert(iterator position, scoped_ptr<T> item) {
124 DCHECK(position <= end()); 125 DCHECK(position <= end());
125 data_.insert(position, item.release()); 126 data_.insert(position, item.release());
126 } 127 }
127 128
128 void swap(ScopedPtrVector<T>& other) { 129 void swap(ScopedPtrVector<T>& other) {
129 data_.swap(other.data_); 130 data_.swap(other.data_);
(...skipping 21 matching lines...) Expand all
151 152
152 private: 153 private:
153 std::vector<T*> data_; 154 std::vector<T*> data_;
154 155
155 DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector); 156 DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector);
156 }; 157 };
157 158
158 } // namespace cc 159 } // namespace cc
159 160
160 #endif // CC_SCOPED_PTR_VECTOR_H_ 161 #endif // CC_SCOPED_PTR_VECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698