Chromium Code Reviews| Index: Source/core/rendering/style/RefVector.h |
| diff --git a/Source/core/rendering/style/RefVector.h b/Source/core/rendering/style/RefVector.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..98e4907e9138083d77965e481a9e0a6e18c58869 |
| --- /dev/null |
| +++ b/Source/core/rendering/style/RefVector.h |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef RefVector_h |
| +#define RefVector_h |
| + |
| +#include "wtf/RefCounted.h" |
| +#include "wtf/RefPtr.h" |
| +#include "wtf/Vector.h" |
| + |
| +namespace WebCore { |
| + |
| +template <typename T> |
| +class RefVector : public RefCounted<RefVector<T> > { |
|
Peter Beverloo
2014/05/01 17:24:51
should this be in wtf/?
andersr
2014/05/02 11:10:35
Probably. Moved.
I guess I need another LGTM, in
|
| +public: |
| + static PassRefPtr<RefVector> create() { return adoptRef(new RefVector<T>); } |
| + PassRefPtr<RefVector> copy() { return adoptRef(new RefVector<T>(*this)); } |
| + |
| + const T& operator[](int i) const { return m_vector[i]; } |
| + T& operator[](int i) { return m_vector[i]; } |
| + const T& at(size_t i) const { return m_vector.at(i); } |
| + T& at(size_t i) { return m_vector.at(i); } |
| + |
| + bool operator==(const RefVector& o) const { return m_vector == o.m_vector; } |
| + bool operator!=(const RefVector& o) const { return m_vector != o.m_vector; } |
| + |
| + size_t size() const { return m_vector.size(); } |
| + void append(const T& decoration) { m_vector.append(decoration); } |
| + const Vector<T>& vector() const { return m_vector; } |
| + |
| +private: |
| + Vector<T> m_vector; |
| + RefVector() { } |
| + RefVector(const RefVector& o) : m_vector(o.m_vector) { } |
| +}; |
| + |
| +} // namespace WebCore |
| + |
| +#endif // RefVector_h |