OLD | NEW |
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 Loading... |
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 Loading... |
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_ |
OLD | NEW |