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 HeapAllocator_h | 5 #ifndef HeapAllocator_h |
6 #define HeapAllocator_h | 6 #define HeapAllocator_h |
7 | 7 |
8 #include "platform/heap/Heap.h" | 8 #include "platform/heap/Heap.h" |
9 #include "platform/heap/Persistent.h" | 9 #include "platform/heap/Persistent.h" |
10 #include "platform/heap/TraceTraits.h" | 10 #include "platform/heap/TraceTraits.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 return allocateHashTableBacking<T, HashTable>(size); | 99 return allocateHashTableBacking<T, HashTable>(size); |
100 } | 100 } |
101 static void freeHashTableBacking(void* address); | 101 static void freeHashTableBacking(void* address); |
102 static bool expandHashTableBacking(void*, size_t); | 102 static bool expandHashTableBacking(void*, size_t); |
103 | 103 |
104 template <typename Return, typename Metadata> | 104 template <typename Return, typename Metadata> |
105 static Return malloc(size_t size, const char* typeName) | 105 static Return malloc(size_t size, const char* typeName) |
106 { | 106 { |
107 return reinterpret_cast<Return>(ThreadHeap::allocate<Metadata>(size, IsE
agerlyFinalizedType<Metadata>::value)); | 107 return reinterpret_cast<Return>(ThreadHeap::allocate<Metadata>(size, IsE
agerlyFinalizedType<Metadata>::value)); |
108 } | 108 } |
109 static void free(void* address) { } | 109 |
| 110 #if OS(WIN) && COMPILER(MSVC) |
| 111 // MSVC eagerly instantiates the unused 'operator delete', |
| 112 // provide a version that asserts and fails at run-time if |
| 113 // used. |
| 114 // Elsewhere we expect compilation to fail if 'delete' is |
| 115 // attempted used and instantiated with a HeapAllocator-based |
| 116 // object, as HeapAllocator::free is not provided. |
| 117 static void free(void*) |
| 118 { |
| 119 NOTREACHED(); |
| 120 } |
| 121 #endif |
| 122 |
110 template<typename T> | 123 template<typename T> |
111 static void* newArray(size_t bytes) | 124 static void* newArray(size_t bytes) |
112 { | 125 { |
113 ASSERT_NOT_REACHED(); | 126 ASSERT_NOT_REACHED(); |
114 return 0; | 127 return 0; |
115 } | 128 } |
116 | 129 |
117 static void deleteArray(void* ptr) | 130 static void deleteArray(void* ptr) |
118 { | 131 { |
119 ASSERT_NOT_REACHED(); | 132 ASSERT_NOT_REACHED(); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 static const bool value = true; | 539 static const bool value = true; |
527 }; | 540 }; |
528 | 541 |
529 template<typename T> struct HashTraits<blink::Persistent<T>> : HandleHashTraits<
T, blink::Persistent<T>> { }; | 542 template<typename T> struct HashTraits<blink::Persistent<T>> : HandleHashTraits<
T, blink::Persistent<T>> { }; |
530 | 543 |
531 template<typename T> struct HashTraits<blink::CrossThreadPersistent<T>> : Handle
HashTraits<T, blink::CrossThreadPersistent<T>> { }; | 544 template<typename T> struct HashTraits<blink::CrossThreadPersistent<T>> : Handle
HashTraits<T, blink::CrossThreadPersistent<T>> { }; |
532 | 545 |
533 } // namespace WTF | 546 } // namespace WTF |
534 | 547 |
535 #endif | 548 #endif |
OLD | NEW |