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

Side by Side Diff: third_party/WebKit/Source/wtf/RefVector.h

Issue 1680803003: Add additive animation support for CSS property background-position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test update Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 RefVector_h 5 #ifndef RefVector_h
6 #define RefVector_h 6 #define RefVector_h
7 7
8 #include "wtf/RefCounted.h" 8 #include "wtf/RefCounted.h"
9 #include "wtf/RefPtr.h" 9 #include "wtf/RefPtr.h"
10 #include "wtf/Vector.h" 10 #include "wtf/Vector.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 template <typename T> 14 template <typename T>
15 class RefVector : public RefCounted<RefVector<T>> { 15 class RefVector : public RefCounted<RefVector<T>> {
16 public: 16 public:
17 static PassRefPtr<RefVector> create() { return adoptRef(new RefVector<T>); } 17 static PassRefPtr<RefVector> create() { return adoptRef(new RefVector<T>); }
18 PassRefPtr<RefVector> copy() { return adoptRef(new RefVector<T>(*this)); } 18 static PassRefPtr<RefVector> create(const Vector<T>& v) { return adoptRef(ne w RefVector<T>(v)); }
19 static PassRefPtr<RefVector> create(Vector<T>&& v) { return adoptRef(new Ref Vector<T>(v)); }
haraken 2016/02/16 18:43:41 v => vector (Blink prefers a fully qualified name.
alancutter (OOO until 2018) 2016/02/17 06:39:51 Done.
20 PassRefPtr<RefVector> copy() { return create(vector()); }
19 21
20 const T& operator[](size_t i) const { return m_vector[i]; } 22 const T& operator[](size_t i) const { return m_vector[i]; }
21 T& operator[](size_t i) { return m_vector[i]; } 23 T& operator[](size_t i) { return m_vector[i]; }
22 const T& at(size_t i) const { return m_vector.at(i); } 24 const T& at(size_t i) const { return m_vector.at(i); }
23 T& at(size_t i) { return m_vector.at(i); } 25 T& at(size_t i) { return m_vector.at(i); }
24 26
25 bool operator==(const RefVector& o) const { return m_vector == o.m_vector; } 27 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; } 28 bool operator!=(const RefVector& o) const { return m_vector != o.m_vector; }
27 29
28 size_t size() const { return m_vector.size(); } 30 size_t size() const { return m_vector.size(); }
29 bool isEmpty() const { return !size(); } 31 bool isEmpty() const { return !size(); }
30 void append(const T& decoration) { m_vector.append(decoration); } 32 void append(const T& decoration) { m_vector.append(decoration); }
31 const Vector<T>& vector() const { return m_vector; } 33 const Vector<T>& vector() const { return m_vector; }
32 34
33 private: 35 private:
34 Vector<T> m_vector; 36 Vector<T> m_vector;
35 RefVector() { } 37 RefVector() { }
36 RefVector(const RefVector& o) : m_vector(o.m_vector) { } 38 RefVector(const Vector<T>& v) : m_vector(v) { }
39 RefVector(Vector<T>&& v) : m_vector(v) { }
haraken 2016/02/16 18:43:41 Ditto.
alancutter (OOO until 2018) 2016/02/17 06:39:51 Done.
37 }; 40 };
38 41
39 } // namespace blink 42 } // namespace blink
40 43
41 #endif // RefVector_h 44 #endif // RefVector_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698