OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BASE_LIST_CONTAINER_HELPER_H_ | 5 #ifndef CC_BASE_LIST_CONTAINER_HELPER_H_ |
6 #define CC_BASE_LIST_CONTAINER_HELPER_H_ | 6 #define CC_BASE_LIST_CONTAINER_HELPER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 // Helper class for ListContainer non-templated logic. All methods are private, | 13 // Helper class for ListContainer non-templated logic. All methods are private, |
14 // and only exposed to friend classes. | 14 // and only exposed to friend classes. |
15 // For usage, see comments in ListContainer (list_container.h). | 15 // For usage, see comments in ListContainer (list_container.h). |
16 class CC_EXPORT ListContainerHelper final { | 16 class CC_EXPORT ListContainerHelper final { |
17 private: | 17 private: |
18 template <typename T> | 18 template <typename T> |
19 friend class ListContainer; | 19 friend class ListContainer; |
20 | 20 |
| 21 template <typename T> |
| 22 friend class RandomAccessListContainer; |
| 23 |
21 explicit ListContainerHelper(size_t max_size_for_derived_class); | 24 explicit ListContainerHelper(size_t max_size_for_derived_class); |
22 ListContainerHelper(size_t max_size_for_derived_class, | 25 ListContainerHelper(size_t max_size_for_derived_class, |
23 size_t num_of_elements_to_reserve_for); | 26 size_t num_of_elements_to_reserve_for); |
24 ~ListContainerHelper(); | 27 ~ListContainerHelper(); |
25 | 28 |
26 // This class deals only with char* and void*. It does allocation and passing | 29 // This class deals only with char* and void*. It does allocation and passing |
27 // out raw pointers, as well as memory deallocation when being destroyed. | 30 // out raw pointers, as well as memory deallocation when being destroyed. |
28 class CharAllocator; | 31 class CharAllocator; |
29 | 32 |
30 // This class points to a certain position inside memory of | 33 // This class points to a certain position inside memory of |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 void* Allocate(size_t size_of_actual_element_in_bytes); | 169 void* Allocate(size_t size_of_actual_element_in_bytes); |
167 | 170 |
168 scoped_ptr<CharAllocator> data_; | 171 scoped_ptr<CharAllocator> data_; |
169 | 172 |
170 DISALLOW_COPY_AND_ASSIGN(ListContainerHelper); | 173 DISALLOW_COPY_AND_ASSIGN(ListContainerHelper); |
171 }; | 174 }; |
172 | 175 |
173 } // namespace cc | 176 } // namespace cc |
174 | 177 |
175 #endif // CC_BASE_LIST_CONTAINER_HELPER_H_ | 178 #endif // CC_BASE_LIST_CONTAINER_HELPER_H_ |
OLD | NEW |