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: |