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

Unified Diff: third_party/WebKit/Source/wtf/ArrayBufferContents.cpp

Issue 1577783004: [v8] don't crash when ArrayBuffer allocation fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a solution which doesn't modify behaviour of existing code, apart from JS TypedArrays Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698