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

Unified Diff: third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h

Issue 2533713002: Call OOM_CRASH when ArrayBuffer allocation fails (Closed)
Patch Set: fix Created 4 years, 1 month 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 | « no previous file | 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/typed_arrays/ArrayBuffer.h
diff --git a/third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h b/third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h
index 2575418c2fef74289208e20a717d1eb61a38d588..82adfb67eb8b112fb11e689abbfd4b6833b2b826 100644
--- a/third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h
+++ b/third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h
@@ -26,6 +26,7 @@
#ifndef ArrayBuffer_h
#define ArrayBuffer_h
+#include "wtf/Assertions.h"
#include "wtf/HashSet.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
@@ -131,7 +132,8 @@ PassRefPtr<ArrayBuffer> ArrayBuffer::create(const void* source,
unsigned byteLength) {
ArrayBufferContents contents(byteLength, 1, ArrayBufferContents::NotShared,
ArrayBufferContents::DontInitialize);
- RELEASE_ASSERT(contents.data());
+ if (UNLIKELY(!contents.data()))
+ OOM_CRASH();
RefPtr<ArrayBuffer> buffer = adoptRef(new ArrayBuffer(contents));
memcpy(buffer->data(), source, byteLength);
return buffer.release();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698