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" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 class SharedQuadState; | 13 class SharedQuadState; |
14 class DrawQuad; | 14 class DrawQuad; |
15 | 15 |
16 // This class is a container type that handles allocating contiguous memory for | 16 // This class is a container type that handles allocating contiguous memory for |
17 // new elements and traversing through elements with either iterator or reverse | 17 // new elements and traversing through elements with either iterator or reverse |
18 // iterator. Since this container hands out raw pointers of its elements, it is | 18 // iterator. Since this container hands out raw pointers of its elements, it is |
19 // very important that this container never reallocate its memory so those raw | 19 // very important that this container never reallocate its memory so those raw |
20 // pointer will continue to be valid. This class is used to contain | 20 // pointer will continue to be valid. This class is used to contain |
21 // SharedQuadState or DrawQuad. Since the size of each DrawQuad varies, to hold | 21 // SharedQuadState or DrawQuad. Since the size of each DrawQuad varies, to hold |
22 // DrawQuads, the allocations size of each element in this class is | 22 // DrawQuads, the allocations size of each element in this class is |
23 // kLargestDrawQuad while BaseElementType is DrawQuad. | 23 // LargestDrawQuadSize while BaseElementType is DrawQuad. |
24 template <class BaseElementType> | 24 template <class BaseElementType> |
25 class CC_EXPORT ListContainer { | 25 class CC_EXPORT ListContainer { |
26 public: | 26 public: |
27 // BaseElementType is the type of raw pointers this class hands out; however, | 27 // BaseElementType is the type of raw pointers this class hands out; however, |
28 // its derived classes might require different memory sizes. | 28 // its derived classes might require different memory sizes. |
29 // max_size_for_derived_class the largest memory size required for all the | 29 // max_size_for_derived_class the largest memory size required for all the |
30 // derived classes to use for allocation. | 30 // derived classes to use for allocation. |
31 explicit ListContainer(size_t max_size_for_derived_class); | 31 explicit ListContainer(size_t max_size_for_derived_class); |
32 // This constructor omits input variable for max_size_for_derived_class. This | 32 // This constructor omits input variable for max_size_for_derived_class. This |
33 // is used when there is no derived classes from BaseElementType we need to | 33 // is used when there is no derived classes from BaseElementType we need to |
(...skipping 191 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 |