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

Unified Diff: Source/core/dom/DOMTypedArray.h

Issue 1328343002: Do not crash when out of memory at ImageData::create(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | « no previous file | Source/core/html/ImageData.h » ('j') | Source/core/html/ImageData.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DOMTypedArray.h
diff --git a/Source/core/dom/DOMTypedArray.h b/Source/core/dom/DOMTypedArray.h
index 8b14ac0d41a56fbc76342c05cec6cb6aff4b946c..e8ea244f2d0bf12225cd317cbcf36dd025915ecb 100644
--- a/Source/core/dom/DOMTypedArray.h
+++ b/Source/core/dom/DOMTypedArray.h
@@ -52,6 +52,12 @@ public:
return adoptRef(new ThisType(bufferView.release(), buffer.release()));
}
+ static PassRefPtr<ThisType> createOrNull(unsigned length)
+ {
+ RefPtr<WTF::ArrayBuffer> buffer = WTF::ArrayBuffer::createOrNull(length, 1);
+ return buffer ? create(buffer.release(), 0, length) : nullptr;
+ }
+
const WTFTypedArray* view() const { return static_cast<const WTFTypedArray*>(DOMArrayBufferView::view()); }
WTFTypedArray* view() { return static_cast<WTFTypedArray*>(DOMArrayBufferView::view()); }
« no previous file with comments | « no previous file | Source/core/html/ImageData.h » ('j') | Source/core/html/ImageData.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698