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

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 little comment explaining the contract 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
« no previous file with comments | « third_party/WebKit/Source/wtf/ArrayBufferContents.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e3c4b0e19425b77a9f5ca307e7f10019d2f75d92 100644
--- a/third_party/WebKit/Source/wtf/ArrayBufferContents.cpp
+++ b/third_party/WebKit/Source/wtf/ArrayBufferContents.cpp
@@ -97,15 +97,25 @@ void ArrayBufferContents::copyTo(ArrayBufferContents& other)
m_holder->copyMemoryTo(*other.m_holder);
}
-void ArrayBufferContents::allocateMemory(size_t size, InitializationPolicy policy, void*& data)
+void ArrayBufferContents::allocateMemoryWithFlags(size_t size, InitializationPolicy policy, int flags, void*& data)
{
if (s_adjustAmountOfExternalAllocatedMemoryFunction)
s_adjustAmountOfExternalAllocatedMemoryFunction(static_cast<int>(size));
- data = partitionAllocGeneric(WTF::Partitions::bufferPartition(), size, WTF_HEAP_PROFILER_TYPE_NAME(ArrayBufferContents));
+ data = partitionAllocGenericFlags(WTF::Partitions::bufferPartition(), flags, size, WTF_HEAP_PROFILER_TYPE_NAME(ArrayBufferContents));
if (policy == ZeroInitialize && data)
memset(data, '\0', size);
}
+void ArrayBufferContents::allocateMemory(size_t size, InitializationPolicy policy, void*& data)
+{
+ allocateMemoryWithFlags(size, policy, 0, data);
+}
+
+void ArrayBufferContents::allocateMemoryOrNull(size_t size, InitializationPolicy policy, void*& data)
+{
+ allocateMemoryWithFlags(size, policy, PartitionAllocReturnNull, data);
+}
+
void ArrayBufferContents::freeMemory(void* data, size_t size)
{
Partitions::bufferFree(data);
« no previous file with comments | « third_party/WebKit/Source/wtf/ArrayBufferContents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698