OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_COMMON_REF_COUNTED_UTIL_H__ | 5 #ifndef CHROME_COMMON_REF_COUNTED_UTIL_H__ |
6 #define CHROME_COMMON_REF_COUNTED_UTIL_H__ | 6 #define CHROME_COMMON_REF_COUNTED_UTIL_H__ |
7 | 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/macros.h" |
8 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
9 #include <vector> | |
10 | 12 |
11 // RefCountedVector is just a vector wrapped up with | 13 // RefCountedVector is just a vector wrapped up with |
12 // RefCountedThreadSafe. | 14 // RefCountedThreadSafe. |
13 template<class T> | 15 template<class T> |
14 class RefCountedVector | 16 class RefCountedVector |
15 : public base::RefCountedThreadSafe<RefCountedVector<T> > { | 17 : public base::RefCountedThreadSafe<RefCountedVector<T> > { |
16 public: | 18 public: |
17 RefCountedVector() {} | 19 RefCountedVector() {} |
18 explicit RefCountedVector(const std::vector<T>& initializer) | 20 explicit RefCountedVector(const std::vector<T>& initializer) |
19 : data(initializer) {} | 21 : data(initializer) {} |
20 | 22 |
21 std::vector<T> data; | 23 std::vector<T> data; |
22 | 24 |
23 private: | 25 private: |
24 friend class base::RefCountedThreadSafe<RefCountedVector<T>>; | 26 friend class base::RefCountedThreadSafe<RefCountedVector<T>>; |
25 ~RefCountedVector() {} | 27 ~RefCountedVector() {} |
26 | 28 |
27 DISALLOW_COPY_AND_ASSIGN(RefCountedVector<T>); | 29 DISALLOW_COPY_AND_ASSIGN(RefCountedVector<T>); |
28 }; | 30 }; |
29 | 31 |
30 #endif // CHROME_COMMON_REF_COUNTED_UTIL_H__ | 32 #endif // CHROME_COMMON_REF_COUNTED_UTIL_H__ |
OLD | NEW |