OLD | NEW |
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 CC_QUADS_LIST_CONTAINER_H_ | 5 #ifndef CC_QUADS_LIST_CONTAINER_H_ |
6 #define CC_QUADS_LIST_CONTAINER_H_ | 6 #define CC_QUADS_LIST_CONTAINER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 class CC_EXPORT Iterator : public PositionInListContainerCharAllocator { | 71 class CC_EXPORT Iterator : public PositionInListContainerCharAllocator { |
72 // This class is only defined to forward iterate through | 72 // This class is only defined to forward iterate through |
73 // ListContainerCharAllocator. | 73 // ListContainerCharAllocator. |
74 public: | 74 public: |
75 Iterator(ListContainerCharAllocator* container, | 75 Iterator(ListContainerCharAllocator* container, |
76 size_t vector_ind, | 76 size_t vector_ind, |
77 char* item_iter, | 77 char* item_iter, |
78 size_t index); | 78 size_t index); |
79 ~Iterator(); | 79 ~Iterator(); |
80 BaseElementType* operator->() const; | 80 BaseElementType* operator->() const; |
81 BaseElementType& operator*() const; | 81 BaseElementType* operator*() const; |
82 Iterator operator++(int unused_post_increment); | 82 Iterator operator++(int unused_post_increment); |
83 Iterator operator++(); | 83 Iterator& operator++(); |
84 | 84 |
85 size_t index() const; | 85 size_t index() const; |
86 | 86 |
87 private: | 87 private: |
88 // This is used to track how many increment has happened since begin(). It | 88 // This is used to track how many increment has happened since begin(). It |
89 // is used to avoid double increment at places an index reference is | 89 // is used to avoid double increment at places an index reference is |
90 // needed. For iterator this means begin() corresponds to index 0 and end() | 90 // needed. For iterator this means begin() corresponds to index 0 and end() |
91 // corresponds to index |size|. | 91 // corresponds to index |size|. |
92 size_t index_; | 92 size_t index_; |
93 }; | 93 }; |
94 | 94 |
95 class CC_EXPORT ConstIterator : public PositionInListContainerCharAllocator { | 95 class CC_EXPORT ConstIterator : public PositionInListContainerCharAllocator { |
96 // This class is only defined to forward iterate through | 96 // This class is only defined to forward iterate through |
97 // ListContainerCharAllocator. | 97 // ListContainerCharAllocator. |
98 public: | 98 public: |
99 ConstIterator(ListContainerCharAllocator* container, | 99 ConstIterator(ListContainerCharAllocator* container, |
100 size_t vector_ind, | 100 size_t vector_ind, |
101 char* item_iter, | 101 char* item_iter, |
102 size_t index); | 102 size_t index); |
103 ConstIterator(const Iterator& other); // NOLINT | 103 ConstIterator(const Iterator& other); // NOLINT |
104 ~ConstIterator(); | 104 ~ConstIterator(); |
105 const BaseElementType* operator->() const; | 105 const BaseElementType* operator->() const; |
106 const BaseElementType& operator*() const; | 106 const BaseElementType* operator*() const; |
107 ConstIterator operator++(int unused_post_increment); | 107 ConstIterator operator++(int unused_post_increment); |
108 ConstIterator operator++(); | 108 ConstIterator& operator++(); |
109 | 109 |
110 size_t index() const; | 110 size_t index() const; |
111 | 111 |
112 private: | 112 private: |
113 // This is used to track how many increment has happened since begin(). It | 113 // This is used to track how many increment has happened since begin(). It |
114 // is used to avoid double increment at places an index reference is | 114 // is used to avoid double increment at places an index reference is |
115 // needed. For iterator this means begin() corresponds to index 0 and end() | 115 // needed. For iterator this means begin() corresponds to index 0 and end() |
116 // corresponds to index |size|. | 116 // corresponds to index |size|. |
117 size_t index_; | 117 size_t index_; |
118 }; | 118 }; |
119 | 119 |
120 class CC_EXPORT ReverseIterator | 120 class CC_EXPORT ReverseIterator |
121 : public PositionInListContainerCharAllocator { | 121 : public PositionInListContainerCharAllocator { |
122 // This class is only defined to reverse iterate through | 122 // This class is only defined to reverse iterate through |
123 // ListContainerCharAllocator. | 123 // ListContainerCharAllocator. |
124 public: | 124 public: |
125 ReverseIterator(ListContainerCharAllocator* container, | 125 ReverseIterator(ListContainerCharAllocator* container, |
126 size_t vector_ind, | 126 size_t vector_ind, |
127 char* item_iter, | 127 char* item_iter, |
128 size_t index); | 128 size_t index); |
129 ~ReverseIterator(); | 129 ~ReverseIterator(); |
130 BaseElementType* operator->() const; | 130 BaseElementType* operator->() const; |
131 BaseElementType& operator*() const; | 131 BaseElementType* operator*() const; |
132 ReverseIterator operator++(int unused_post_increment); | 132 ReverseIterator operator++(int unused_post_increment); |
133 ReverseIterator operator++(); | 133 ReverseIterator& operator++(); |
134 | 134 |
135 size_t index() const; | 135 size_t index() const; |
136 | 136 |
137 private: | 137 private: |
138 // This is used to track how many increment has happened since rbegin(). It | 138 // This is used to track how many increment has happened since rbegin(). It |
139 // is used to avoid double increment at places an index reference is | 139 // is used to avoid double increment at places an index reference is |
140 // needed. For reverse iterator this means rbegin() corresponds to index 0 | 140 // needed. For reverse iterator this means rbegin() corresponds to index 0 |
141 // and rend() corresponds to index |size|. | 141 // and rend() corresponds to index |size|. |
142 size_t index_; | 142 size_t index_; |
143 }; | 143 }; |
144 | 144 |
145 class CC_EXPORT ConstReverseIterator | 145 class CC_EXPORT ConstReverseIterator |
146 : public PositionInListContainerCharAllocator { | 146 : public PositionInListContainerCharAllocator { |
147 // This class is only defined to reverse iterate through | 147 // This class is only defined to reverse iterate through |
148 // ListContainerCharAllocator. | 148 // ListContainerCharAllocator. |
149 public: | 149 public: |
150 ConstReverseIterator(ListContainerCharAllocator* container, | 150 ConstReverseIterator(ListContainerCharAllocator* container, |
151 size_t vector_ind, | 151 size_t vector_ind, |
152 char* item_iter, | 152 char* item_iter, |
153 size_t index); | 153 size_t index); |
154 ConstReverseIterator(const ReverseIterator& other); // NOLINT | 154 ConstReverseIterator(const ReverseIterator& other); // NOLINT |
155 ~ConstReverseIterator(); | 155 ~ConstReverseIterator(); |
156 const BaseElementType* operator->() const; | 156 const BaseElementType* operator->() const; |
157 const BaseElementType& operator*() const; | 157 const BaseElementType* operator*() const; |
158 ConstReverseIterator operator++(int unused_post_increment); | 158 ConstReverseIterator operator++(int unused_post_increment); |
159 ConstReverseIterator operator++(); | 159 ConstReverseIterator& operator++(); |
160 | 160 |
161 size_t index() const; | 161 size_t index() const; |
162 | 162 |
163 private: | 163 private: |
164 // This is used to track how many increment has happened since rbegin(). It | 164 // This is used to track how many increment has happened since rbegin(). It |
165 // is used to avoid double increment at places an index reference is | 165 // is used to avoid double increment at places an index reference is |
166 // needed. For reverse iterator this means rbegin() corresponds to index 0 | 166 // needed. For reverse iterator this means rbegin() corresponds to index 0 |
167 // and rend() corresponds to index |size|. | 167 // and rend() corresponds to index |size|. |
168 size_t index_; | 168 size_t index_; |
169 }; | 169 }; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 DISALLOW_COPY_AND_ASSIGN(ListContainer); | 225 DISALLOW_COPY_AND_ASSIGN(ListContainer); |
226 }; | 226 }; |
227 | 227 |
228 #if !defined(COMPILER_MSVC) | 228 #if !defined(COMPILER_MSVC) |
229 extern template class ListContainer<SharedQuadState>; | 229 extern template class ListContainer<SharedQuadState>; |
230 extern template class ListContainer<DrawQuad>; | 230 extern template class ListContainer<DrawQuad>; |
231 #endif | 231 #endif |
232 } // namespace cc | 232 } // namespace cc |
233 | 233 |
234 #endif // CC_QUADS_LIST_CONTAINER_H_ | 234 #endif // CC_QUADS_LIST_CONTAINER_H_ |
OLD | NEW |