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

Unified Diff: third_party/WebKit/Source/core/dom/DOMSharedArrayBuffer.h

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/dom/DOMSharedArrayBuffer.h
diff --git a/third_party/WebKit/Source/core/dom/DOMSharedArrayBuffer.h b/third_party/WebKit/Source/core/dom/DOMSharedArrayBuffer.h
index e1bfb23c17cf6302ae583bfca2a9a6ca7fae9129..f24f715584f90f152fb90008a795da04fb4591d7 100644
--- a/third_party/WebKit/Source/core/dom/DOMSharedArrayBuffer.h
+++ b/third_party/WebKit/Source/core/dom/DOMSharedArrayBuffer.h
@@ -14,25 +14,31 @@ namespace blink {
class CORE_EXPORT DOMSharedArrayBuffer final : public DOMArrayBufferBase {
DEFINE_WRAPPERTYPEINFO();
public:
- static PassRefPtr<DOMSharedArrayBuffer> create(PassRefPtr<WTF::ArrayBuffer> buffer)
+ static PassRefPtr<DOMSharedArrayBuffer> createOrNull(PassRefPtr<WTF::ArrayBuffer> buffer)
{
+ if (!buffer)
+ return nullptr;
ASSERT(buffer->isShared());
return adoptRef(new DOMSharedArrayBuffer(buffer));
}
- static PassRefPtr<DOMSharedArrayBuffer> create(unsigned numElements, unsigned elementByteSize)
+ static PassRefPtr<DOMSharedArrayBuffer> createOrNull(unsigned numElements, unsigned elementByteSize)
{
- return create(WTF::ArrayBuffer::createShared(numElements, elementByteSize));
+ return createOrNull(WTF::ArrayBuffer::createSharedOrNull(numElements, elementByteSize));
}
- static PassRefPtr<DOMSharedArrayBuffer> create(const void* source, unsigned byteLength)
+ static PassRefPtr<DOMSharedArrayBuffer> createOrNull(const void* source, unsigned byteLength)
{
- return create(WTF::ArrayBuffer::createShared(source, byteLength));
+ return createOrNull(WTF::ArrayBuffer::createSharedOrNull(source, byteLength));
}
static PassRefPtr<DOMSharedArrayBuffer> create(WTF::ArrayBufferContents& contents)
{
ASSERT(contents.isShared());
- return create(WTF::ArrayBuffer::create(contents));
+ return adoptRef(new DOMSharedArrayBuffer(WTF::ArrayBuffer::create(contents)));
+ }
+ static PassRefPtr<DOMSharedArrayBuffer> create(PassRefPtr<WTF::ArrayBuffer> buffer)
+ {
+ ASSERT(buffer && buffer->isShared());
+ return adoptRef(new DOMSharedArrayBuffer(buffer));
}
-
v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationContext) override;
private:
« no previous file with comments | « third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp ('k') | third_party/WebKit/Source/core/dom/DOMTypedArray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698