Chromium Code Reviews| Index: third_party/WebKit/Source/wtf/ArrayBufferContents.cpp |
| diff --git a/third_party/WebKit/Source/wtf/ArrayBufferContents.cpp b/third_party/WebKit/Source/wtf/ArrayBufferContents.cpp |
| index d017b5690b80bb79f9e2320c4782f1e082988e6d..0962623bb8ff06baf9f5e52e83d81d52c80e93d6 100644 |
| --- a/third_party/WebKit/Source/wtf/ArrayBufferContents.cpp |
| +++ b/third_party/WebKit/Source/wtf/ArrayBufferContents.cpp |
| @@ -106,6 +106,15 @@ void ArrayBufferContents::allocateMemory(size_t size, InitializationPolicy polic |
| memset(data, '\0', size); |
| } |
| +void ArrayBufferContents::allocateMemoryOrNull(size_t size, InitializationPolicy policy, void*& data) |
| +{ |
| + if (s_adjustAmountOfExternalAllocatedMemoryFunction) |
| + s_adjustAmountOfExternalAllocatedMemoryFunction(static_cast<int>(size)); |
| + data = partitionAllocGenericFlags(WTF::Partitions::bufferPartition(), PartitionAllocReturnNull, size, WTF_HEAP_PROFILER_TYPE_NAME(ArrayBufferContents)); |
| + if (policy == ZeroInitialize && data) |
| + memset(data, '\0', size); |
| +} |
|
Dan Ehrenberg
2016/01/13 22:55:14
Any way you could reduce the duplication here with
caitp (gmail)
2016/01/13 23:41:10
done
|
| + |
| void ArrayBufferContents::freeMemory(void* data, size_t size) |
| { |
| Partitions::bufferFree(data); |