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

Unified Diff: third_party/WebKit/Source/wtf/RefVector.h

Issue 2774333002: Revert "Move files in wtf/ to platform/wtf/" (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/RefPtrTest.cpp ('k') | third_party/WebKit/Source/wtf/SaturatedArithmetic.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/RefVector.h
diff --git a/third_party/WebKit/Source/wtf/RefVector.h b/third_party/WebKit/Source/wtf/RefVector.h
index 1adeee738addd6e158fb56a4a201c9695eb68c8c..4cfe6e446f08008678e011324d120f9fef08ff1c 100644
--- a/third_party/WebKit/Source/wtf/RefVector.h
+++ b/third_party/WebKit/Source/wtf/RefVector.h
@@ -1,9 +1,48 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// 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.
-#include "platform/wtf/RefVector.h"
+#ifndef RefVector_h
+#define RefVector_h
-// The contents of this header was moved to platform/wtf as part of
-// WTF migration project. See the following post for details:
-// https://groups.google.com/a/chromium.org/d/msg/blink-dev/tLdAZCTlcAA/bYXVT8gYCAAJ
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+
+namespace blink {
+
+template <typename T>
+class RefVector : public RefCounted<RefVector<T>> {
+ public:
+ static PassRefPtr<RefVector> create() { return adoptRef(new RefVector<T>); }
+ static PassRefPtr<RefVector> create(const Vector<T>& vector) {
+ return adoptRef(new RefVector<T>(vector));
+ }
+ static PassRefPtr<RefVector> create(Vector<T>&& vector) {
+ return adoptRef(new RefVector<T>(vector));
+ }
+ PassRefPtr<RefVector> copy() { return create(vector()); }
+
+ const T& operator[](size_t i) const { return m_vector[i]; }
+ T& operator[](size_t 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(); }
+ bool isEmpty() const { return !size(); }
+ void append(const T& decoration) { m_vector.push_back(decoration); }
+ const Vector<T>& vector() const { return m_vector; }
+
+ private:
+ Vector<T> m_vector;
+ RefVector() {}
+ RefVector(const Vector<T>& vector) : m_vector(vector) {}
+ RefVector(Vector<T>&& vector) : m_vector(vector) {}
+};
+
+} // namespace blink
+
+#endif // RefVector_h
« no previous file with comments | « third_party/WebKit/Source/wtf/RefPtrTest.cpp ('k') | third_party/WebKit/Source/wtf/SaturatedArithmetic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698