Commit 95033a3e authored by yhirano's avatar yhirano Committed by Commit bot

Call OOM_CRASH when ArrayBuffer allocation fails

BUG=None

Review-Url: https://codereview.chromium.org/2533713002
Cr-Commit-Position: refs/heads/master@{#434653}
parent aea27953
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#ifndef ArrayBuffer_h #ifndef ArrayBuffer_h
#define ArrayBuffer_h #define ArrayBuffer_h
#include "wtf/Assertions.h"
#include "wtf/HashSet.h" #include "wtf/HashSet.h"
#include "wtf/PassRefPtr.h" #include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h" #include "wtf/RefCounted.h"
...@@ -131,7 +132,8 @@ PassRefPtr<ArrayBuffer> ArrayBuffer::create(const void* source, ...@@ -131,7 +132,8 @@ PassRefPtr<ArrayBuffer> ArrayBuffer::create(const void* source,
unsigned byteLength) { unsigned byteLength) {
ArrayBufferContents contents(byteLength, 1, ArrayBufferContents::NotShared, ArrayBufferContents contents(byteLength, 1, ArrayBufferContents::NotShared,
ArrayBufferContents::DontInitialize); ArrayBufferContents::DontInitialize);
RELEASE_ASSERT(contents.data()); if (UNLIKELY(!contents.data()))
OOM_CRASH();
RefPtr<ArrayBuffer> buffer = adoptRef(new ArrayBuffer(contents)); RefPtr<ArrayBuffer> buffer = adoptRef(new ArrayBuffer(contents));
memcpy(buffer->data(), source, byteLength); memcpy(buffer->data(), source, byteLength);
return buffer.release(); return buffer.release();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment