Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef RefVector_h | |
| 6 #define RefVector_h | |
| 7 | |
| 8 #include "wtf/RefCounted.h" | |
| 9 #include "wtf/RefPtr.h" | |
| 10 #include "wtf/Vector.h" | |
| 11 | |
| 12 namespace WebCore { | |
| 13 | |
| 14 template <typename T> | |
| 15 class RefVector : public RefCounted<RefVector<T> > { | |
| 16 public: | |
| 17 static PassRefPtr<RefVector> create() { return adoptRef(new RefVector<T>); } | |
| 18 PassRefPtr<RefVector> copy() { return adoptRef(new RefVector<T>(*this)); } | |
| 19 | |
| 20 const T& operator[](size_t i) const { return m_vector[i]; } | |
| 21 T& operator[](size_t i) { return m_vector[i]; } | |
| 22 const T& at(size_t i) const { return m_vector.at(i); } | |
| 23 T& at(size_t i) { return m_vector.at(i); } | |
|
Julien - ping for review
2014/05/05 17:45:08
The at() functions are not used in the patch, coul
andersr
2014/05/06 13:15:29
Done.
| |
| 24 | |
| 25 bool operator==(const RefVector& o) const { return m_vector == o.m_vector; } | |
| 26 bool operator!=(const RefVector& o) const { return m_vector != o.m_vector; } | |
| 27 | |
| 28 size_t size() const { return m_vector.size(); } | |
| 29 void append(const T& decoration) { m_vector.append(decoration); } | |
| 30 const Vector<T>& vector() const { return m_vector; } | |
| 31 | |
| 32 private: | |
| 33 Vector<T> m_vector; | |
| 34 RefVector() { } | |
| 35 RefVector(const RefVector& o) : m_vector(o.m_vector) { } | |
| 36 }; | |
| 37 | |
| 38 } // namespace WebCore | |
| 39 | |
| 40 #endif // RefVector_h | |
| OLD | NEW |