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

Side by Side Diff: cc/quads/list_container.h

Issue 979693005: Add underlays and split off common overlay functionality (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more unused headers Created 5 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 unified diff | Download patch
« cc/output/overlay_unittest.cc ('K') | « cc/output/overlay_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 DerivedElementType* AllocateAndConstruct() { 202 DerivedElementType* AllocateAndConstruct() {
203 return new (Allocate(sizeof(DerivedElementType))) DerivedElementType; 203 return new (Allocate(sizeof(DerivedElementType))) DerivedElementType;
204 } 204 }
205 // Take in derived element type and copy construct it at location generated by 205 // Take in derived element type and copy construct it at location generated by
206 // Allocate(). 206 // Allocate().
207 template <typename DerivedElementType> 207 template <typename DerivedElementType>
208 DerivedElementType* AllocateAndCopyFrom(const DerivedElementType* source) { 208 DerivedElementType* AllocateAndCopyFrom(const DerivedElementType* source) {
209 return new (Allocate(sizeof(DerivedElementType))) 209 return new (Allocate(sizeof(DerivedElementType)))
210 DerivedElementType(*source); 210 DerivedElementType(*source);
211 } 211 }
212 // Construct a new element on top of an existing one.
213 template <typename DerivedElementType>
214 DerivedElementType* ReplaceExistingElement(Iterator at) {
danakj 2015/03/24 17:55:15 Can you add unit tests for this method?
achaulk 2015/03/27 17:17:47 Done.
215 at->~BaseElementType();
216 return new (*at) DerivedElementType();
217 }
212 218
213 size_t size() const; 219 size_t size() const;
214 bool empty() const; 220 bool empty() const;
215 void clear(); 221 void clear();
216 222
217 size_t AvailableSizeWithoutAnotherAllocationForTesting() const; 223 size_t AvailableSizeWithoutAnotherAllocationForTesting() const;
218 224
219 private: 225 private:
220 // Hands out memory location for an element at the end of data structure. 226 // Hands out memory location for an element at the end of data structure.
221 BaseElementType* Allocate(size_t size_of_actual_element_in_bytes); 227 BaseElementType* Allocate(size_t size_of_actual_element_in_bytes);
222 228
223 scoped_ptr<ListContainerCharAllocator> data_; 229 scoped_ptr<ListContainerCharAllocator> data_;
224 230
225 DISALLOW_COPY_AND_ASSIGN(ListContainer); 231 DISALLOW_COPY_AND_ASSIGN(ListContainer);
226 }; 232 };
227 233
228 #if !defined(COMPILER_MSVC) 234 #if !defined(COMPILER_MSVC)
229 extern template class ListContainer<SharedQuadState>; 235 extern template class ListContainer<SharedQuadState>;
230 extern template class ListContainer<DrawQuad>; 236 extern template class ListContainer<DrawQuad>;
231 #endif 237 #endif
232 } // namespace cc 238 } // namespace cc
233 239
234 #endif // CC_QUADS_LIST_CONTAINER_H_ 240 #endif // CC_QUADS_LIST_CONTAINER_H_
OLDNEW
« cc/output/overlay_unittest.cc ('K') | « cc/output/overlay_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698