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

Unified Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+more tweaks Created 5 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
Index: third_party/WebKit/Source/core/testing/Internals.cpp
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index a7c18c2036d87cdca8c8e8720a8d28609da1d9c7..e2d4b00af1d16e3e0594238864f8f427ec9846eb 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -2127,10 +2127,16 @@ bool Internals::cursorUpdatePending() const
return frame()->eventHandler().cursorUpdatePending();
}
+void Internals::fakeOutOfMemoryForNextArrayBufferAllocation() const
+{
+ WTF::ArrayBufferContents::fakeOutOfMemoryForNextArrayBufferAllocationForTesting();
+}
+
PassRefPtr<DOMArrayBuffer> Internals::serializeObject(PassRefPtr<SerializedScriptValue> value) const
{
String stringValue = value->toWireString();
- RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::createUninitialized(stringValue.length(), sizeof(UChar));
+ RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::createUninitializedOrNull(stringValue.length(), sizeof(UChar));
+ RELEASE_ASSERT(buffer); // Crash here means out of memory.
stringValue.copyTo(static_cast<UChar*>(buffer->data()), 0, stringValue.length());
return buffer.release();
}
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.h ('k') | third_party/WebKit/Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698