Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CollectionsWTF_h | 5 #ifndef CollectionsWTF_h |
| 6 #define CollectionsWTF_h | 6 #define CollectionsWTF_h |
| 7 | 7 |
| 8 #include "wtf/Allocator.h" | 8 #include "wtf/Allocator.h" |
| 9 #include "wtf/HashMap.h" | 9 #include "wtf/HashMap.h" |
| 10 #include "wtf/PassOwnPtr.h" | 10 #include "wtf/PassOwnPtr.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 typedef const OwnPtr<T>* const_iterator; | 60 typedef const OwnPtr<T>* const_iterator; |
| 61 | 61 |
| 62 iterator begin() { return m_impl.begin(); } | 62 iterator begin() { return m_impl.begin(); } |
| 63 iterator end() { return m_impl.end(); } | 63 iterator end() { return m_impl.end(); } |
| 64 const_iterator begin() const { return m_impl.begin(); } | 64 const_iterator begin() const { return m_impl.begin(); } |
| 65 const_iterator end() const { return m_impl.end(); } | 65 const_iterator end() const { return m_impl.end(); } |
| 66 | 66 |
| 67 void resize(size_t s) { m_impl.resize(s); } | 67 void resize(size_t s) { m_impl.resize(s); } |
| 68 size_t size() const { return m_impl.size(); } | 68 size_t size() const { return m_impl.size(); } |
| 69 bool isEmpty() const { return m_impl.isEmpty(); } | 69 bool isEmpty() const { return m_impl.isEmpty(); } |
| 70 OwnPtr<T>& operator[](size_t i) { return m_impl.at(i); } | 70 T* operator[](size_t i) { return m_impl.at(i).get(); } |
| 71 const OwnPtr<T>& operator[](size_t i) const { return m_impl.at(i); } | 71 const T* operator[](size_t i) const { return m_impl.at(i).get(); } |
| 72 OwnPtr<T>& at(size_t i) { return m_impl.at(i); } | 72 T* at(size_t i) { return m_impl.at(i).get(); } |
| 73 const OwnPtr<T>& at(size_t i) const { return m_impl.at(i); } | 73 const T* at(size_t i) const { return m_impl.at(i).get(); } |
| 74 OwnPtr<T>& last() { return m_impl.last(); } | 74 T* last() { return m_impl.last().get(); } |
| 75 const OwnPtr<T>& last() const { return m_impl.last(); } | 75 const T* last() const { return m_impl.last(); } |
|
dgozman
2016/05/21 01:55:29
.get() ?
| |
| 76 void append(PassOwnPtr<T> t) { m_impl.append(std::move(t)); } | 76 void append(PassOwnPtr<T> t) { m_impl.append(std::move(t)); } |
| 77 void prepend(PassOwnPtr<T> t) { m_impl.prepend(std::move(t)); } | 77 void prepend(PassOwnPtr<T> t) { m_impl.prepend(std::move(t)); } |
| 78 void remove(size_t i) { m_impl.remove(i); } | 78 void remove(size_t i) { m_impl.remove(i); } |
| 79 void clear() { m_impl.clear(); } | 79 void clear() { m_impl.clear(); } |
| 80 void swap(Vector<OwnPtr<T>>& other) { m_impl.swap(other.m_impl); } | 80 void swap(Vector<OwnPtr<T>>& other) { m_impl.swap(other.m_impl); } |
| 81 void swap(Vector<OwnPtr<T>>&& other) { m_impl.swap(other.m_impl); } | 81 void swap(Vector<OwnPtr<T>>&& other) { m_impl.swap(other.m_impl); } |
| 82 void removeLast() { m_impl.removeLast(); } | 82 void removeLast() { m_impl.removeLast(); } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 WTF::Vector<OwnPtr<T>> m_impl; | 85 WTF::Vector<OwnPtr<T>> m_impl; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 template <typename K> | 184 template <typename K> |
| 185 class HashSet : public protocol::HashMap<K, K> { | 185 class HashSet : public protocol::HashMap<K, K> { |
| 186 public: | 186 public: |
| 187 void add(const K& k) { this->set(k, k); } | 187 void add(const K& k) { this->set(k, k); } |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 } // namespace platform | 190 } // namespace platform |
| 191 } // namespace blink | 191 } // namespace blink |
| 192 | 192 |
| 193 #endif // !defined(CollectionsWTF_h) | 193 #endif // !defined(CollectionsWTF_h) |
| OLD | NEW |