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

Side by Side Diff: cc/base/scoped_ptr_vector.h

Issue 13051003: cpplint.py pass on cc/(base|debug|quads|resources)/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix prioritized_resource_unittest Created 7 years, 9 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 | « cc/base/scoped_ptr_hash_map.h ('k') | cc/base/tiling_data.h » ('j') | 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_BASE_SCOPED_PTR_VECTOR_H_ 5 #ifndef CC_BASE_SCOPED_PTR_VECTOR_H_
6 #define CC_BASE_SCOPED_PTR_VECTOR_H_ 6 #define CC_BASE_SCOPED_PTR_VECTOR_H_
7 7
8 #include <algorithm>
9 #include <vector>
10
8 #include "base/basictypes.h" 11 #include "base/basictypes.h"
9 #include "base/logging.h" 12 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
11 #include "base/stl_util.h" 14 #include "base/stl_util.h"
12 15
13 namespace cc { 16 namespace cc {
14 17
15 // This type acts like a vector<scoped_ptr> based on top of std::vector. The 18 // This type acts like a vector<scoped_ptr> based on top of std::vector. The
16 // ScopedPtrVector has ownership of all elements in the vector. 19 // ScopedPtrVector has ownership of all elements in the vector.
17 template <typename T> 20 template <typename T>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 DCHECK(b < end()); 138 DCHECK(b < end());
136 if (a == end() || b == end() || a == b) 139 if (a == end() || b == end() || a == b)
137 return; 140 return;
138 typename std::vector<T*>::iterator writable_a = a; 141 typename std::vector<T*>::iterator writable_a = a;
139 typename std::vector<T*>::iterator writable_b = b; 142 typename std::vector<T*>::iterator writable_b = b;
140 std::swap(*writable_a, *writable_b); 143 std::swap(*writable_a, *writable_b);
141 } 144 }
142 145
143 template<class Compare> 146 template<class Compare>
144 inline void sort(Compare comp) { 147 inline void sort(Compare comp) {
145 std::sort(data_.begin(), data_.end(), comp); 148 std::sort(data_.begin(), data_.end(), comp);
146 } 149 }
147 150
148 iterator begin() { return static_cast<iterator>(data_.begin()); } 151 iterator begin() { return static_cast<iterator>(data_.begin()); }
149 const_iterator begin() const { return data_.begin(); } 152 const_iterator begin() const { return data_.begin(); }
150 iterator end() { return static_cast<iterator>(data_.end()); } 153 iterator end() { return static_cast<iterator>(data_.end()); }
151 const_iterator end() const { return data_.end(); } 154 const_iterator end() const { return data_.end(); }
152 155
153 reverse_iterator rbegin() { return data_.rbegin(); } 156 reverse_iterator rbegin() { return data_.rbegin(); }
154 const_reverse_iterator rbegin() const { return data_.rbegin(); } 157 const_reverse_iterator rbegin() const { return data_.rbegin(); }
155 reverse_iterator rend() { return data_.rend(); } 158 reverse_iterator rend() { return data_.rend(); }
156 const_reverse_iterator rend() const { return data_.rend(); } 159 const_reverse_iterator rend() const { return data_.rend(); }
157 160
158 private: 161 private:
159 std::vector<T*> data_; 162 std::vector<T*> data_;
160 163
161 DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector); 164 DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector);
162 }; 165 };
163 166
164 } // namespace cc 167 } // namespace cc
165 168
166 #endif // CC_BASE_SCOPED_PTR_VECTOR_H_ 169 #endif // CC_BASE_SCOPED_PTR_VECTOR_H_
OLDNEW
« no previous file with comments | « cc/base/scoped_ptr_hash_map.h ('k') | cc/base/tiling_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698