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 #ifndef TerminatedArrayBuilder_h | 4 #ifndef TerminatedArrayBuilder_h |
5 #define TerminatedArrayBuilder_h | 5 #define TerminatedArrayBuilder_h |
6 | 6 |
7 #include "wtf/OwnPtr.h" | 7 #include "wtf/Allocator.h" |
8 | 8 |
9 namespace WTF { | 9 namespace WTF { |
10 | 10 |
11 template<typename T, template <typename> class ArrayType = TerminatedArray> | 11 template<typename T, template <typename> class ArrayType = TerminatedArray> |
12 class TerminatedArrayBuilder { | 12 class TerminatedArrayBuilder { |
13 DISALLOW_NEW(); | 13 STACK_ALLOCATED(); |
14 WTF_MAKE_NONCOPYABLE(TerminatedArrayBuilder); | 14 WTF_MAKE_NONCOPYABLE(TerminatedArrayBuilder); |
15 public: | 15 public: |
16 explicit TerminatedArrayBuilder(typename ArrayType<T>::Allocator::PassPtr ar
ray) | 16 explicit TerminatedArrayBuilder(typename ArrayType<T>::Allocator::PassPtr ar
ray) |
17 : m_array(array) | 17 : m_array(array) |
18 , m_count(0) | 18 , m_count(0) |
19 , m_capacity(0) | 19 , m_capacity(0) |
20 { | 20 { |
21 if (!m_array) | 21 if (!m_array) |
22 return; | 22 return; |
23 m_capacity = m_count = m_array->size(); | 23 m_capacity = m_count = m_array->size(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 typename ArrayType<T>::Allocator::Ptr m_array; | 73 typename ArrayType<T>::Allocator::Ptr m_array; |
74 size_t m_count; | 74 size_t m_count; |
75 size_t m_capacity; | 75 size_t m_capacity; |
76 }; | 76 }; |
77 | 77 |
78 } // namespace WTF | 78 } // namespace WTF |
79 | 79 |
80 using WTF::TerminatedArrayBuilder; | 80 using WTF::TerminatedArrayBuilder; |
81 | 81 |
82 #endif // TerminatedArrayBuilder_h | 82 #endif // TerminatedArrayBuilder_h |
OLD | NEW |