struct VectorBackingHelper {
typedef void Type;
};
- template<typename T, typename U, typename V, typename W, typename X>
+ template<typename T>
struct HashTableBackingHelper {
typedef void Type;
};
template <typename Return, typename Metadata>
static Return backingMalloc(size_t size)
{
- return reinterpret_cast<Return>(partitionAllocGeneric(Partitions::getBufferPartition(), size));
+ return reinterpret_cast<Return>(backingAllocate(size));
}
template <typename Return, typename Metadata>
static Return zeroedBackingMalloc(size_t size)
{
- void* result = partitionAllocGeneric(Partitions::getBufferPartition(), size);
+ void* result = backingAllocate(size);
memset(result, 0, size);
return reinterpret_cast<Return>(result);
}
{
return reinterpret_cast<Return>(fastMalloc(size));
}
- static void backingFree(void* address)
- {
- partitionFreeGeneric(Partitions::getBufferPartition(), address);
- }
+ WTF_EXPORT static void backingFree(void* address);
static void free(void* address)
{
fastFree(address);
{
return *other;
}
+
+private:
+ WTF_EXPORT static void* backingAllocate(size_t);
};
// The Windows compiler seems to be very eager to instantiate things it won't
} // namespace WTF
+#define WTF_USE_ALLOCATOR(ClassName, Allocator) \
+public: \
+ void* operator new(size_t size) \
+ { \
+ return Allocator::template malloc<void*, ClassName>(size); \
+ } \
+ void operator delete(void* p) { Allocator::free(p); } \
+ void* operator new[](size_t size) { return Allocator::template newArray<ClassName>(size); } \
+ void operator delete[](void* p) { Allocator::deleteArray(p); } \
+ void* operator new(size_t, NotNullTag, void* location) \
+ { \
+ ASSERT(location); \
+ return location; \
+ } \
+private: \
+typedef int __thisIsHereToForceASemicolonAfterThisMacro
+
using WTF::DefaultAllocator;
#endif // WTF_DefaultAllocator_h