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

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapTerminatedArray.h

Issue 1884113002: Remove RawPtr.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix HeapTest.Bind expectation Created 4 years, 8 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
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 HeapTerminatedArray_h 5 #ifndef HeapTerminatedArray_h
6 #define HeapTerminatedArray_h 6 #define HeapTerminatedArray_h
7 7
8 #include "platform/heap/Heap.h" 8 #include "platform/heap/Heap.h"
9 #include "wtf/TerminatedArray.h" 9 #include "wtf/TerminatedArray.h"
10 #include "wtf/TerminatedArrayBuilder.h" 10 #include "wtf/TerminatedArrayBuilder.h"
(...skipping 12 matching lines...) Expand all
23 for (typename TerminatedArray<T>::iterator it = begin(); it != end(); ++ it) 23 for (typename TerminatedArray<T>::iterator it = begin(); it != end(); ++ it)
24 visitor->trace(*it); 24 visitor->trace(*it);
25 } 25 }
26 26
27 private: 27 private:
28 // Allocator describes how HeapTerminatedArrayBuilder should create new inta nces 28 // Allocator describes how HeapTerminatedArrayBuilder should create new inta nces
29 // of TerminateArray and manage their lifetimes. 29 // of TerminateArray and manage their lifetimes.
30 struct Allocator final { 30 struct Allocator final {
31 STATIC_ONLY(Allocator); 31 STATIC_ONLY(Allocator);
32 typedef HeapTerminatedArray* PassPtr; 32 typedef HeapTerminatedArray* PassPtr;
33 typedef RawPtr<HeapTerminatedArray> Ptr; 33 typedef HeapTerminatedArray* Ptr;
34
35 static PassPtr release(Ptr ptr)
36 {
37 return ptr;
38 }
34 39
35 static PassPtr create(size_t capacity) 40 static PassPtr create(size_t capacity)
36 { 41 {
37 return reinterpret_cast<HeapTerminatedArray*>(Heap::allocate<HeapTer minatedArray>(capacity * sizeof(T), IsEagerlyFinalizedType<T>::value)); 42 return reinterpret_cast<HeapTerminatedArray*>(Heap::allocate<HeapTer minatedArray>(capacity * sizeof(T), IsEagerlyFinalizedType<T>::value));
38 } 43 }
39 44
40 static PassPtr resize(PassPtr ptr, size_t capacity) 45 static PassPtr resize(PassPtr ptr, size_t capacity)
41 { 46 {
42 return reinterpret_cast<HeapTerminatedArray*>(Heap::reallocate<HeapT erminatedArray>(ptr, capacity * sizeof(T))); 47 return reinterpret_cast<HeapTerminatedArray*>(Heap::reallocate<HeapT erminatedArray>(ptr, capacity * sizeof(T)));
43 } 48 }
44 }; 49 };
45 50
46 // Prohibit construction. Allocator makes HeapTerminatedArray instances for 51 // Prohibit construction. Allocator makes HeapTerminatedArray instances for
47 // HeapTerminatedArrayBuilder by pointer casting. 52 // HeapTerminatedArrayBuilder by pointer casting.
48 HeapTerminatedArray(); 53 HeapTerminatedArray();
49 54
50 template<typename U, template <typename> class> friend class WTF::Terminated ArrayBuilder; 55 template<typename U, template <typename> class> friend class WTF::Terminated ArrayBuilder;
51 }; 56 };
52 57
53 template<typename T> 58 template<typename T>
54 class TraceEagerlyTrait<HeapTerminatedArray<T>> { 59 class TraceEagerlyTrait<HeapTerminatedArray<T>> {
55 public: 60 public:
56 static const bool value = TraceEagerlyTrait<T>::value; 61 static const bool value = TraceEagerlyTrait<T>::value;
57 }; 62 };
58 63
59 } // namespace blink 64 } // namespace blink
60 65
61 #endif // HeapTerminatedArray_h 66 #endif // HeapTerminatedArray_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapAllocator.h ('k') | third_party/WebKit/Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698