Index: third_party/WebKit/Source/core/dom/DOMArrayBuffer.h |
diff --git a/third_party/WebKit/Source/core/dom/DOMArrayBuffer.h b/third_party/WebKit/Source/core/dom/DOMArrayBuffer.h |
index 583be56308ff58badf8e21fb6e6b0e8bbcc0d684..c2fef06b6e6cf1947983045f69faa2e85b609148 100644 |
--- a/third_party/WebKit/Source/core/dom/DOMArrayBuffer.h |
+++ b/third_party/WebKit/Source/core/dom/DOMArrayBuffer.h |
@@ -14,37 +14,51 @@ namespace blink { |
class CORE_EXPORT DOMArrayBuffer final : public DOMArrayBufferBase { |
DEFINE_WRAPPERTYPEINFO(); |
public: |
- static PassRefPtr<DOMArrayBuffer> create(PassRefPtr<WTF::ArrayBuffer> buffer) |
+ static PassRefPtr<DOMArrayBuffer> createOrNull(PassRefPtr<WTF::ArrayBuffer> buffer) |
{ |
+ if (!buffer) |
+ return nullptr; |
return adoptRef(new DOMArrayBuffer(buffer)); |
} |
- static PassRefPtr<DOMArrayBuffer> create(unsigned numElements, unsigned elementByteSize) |
+ static PassRefPtr<DOMArrayBuffer> createOrNull(unsigned numElements, unsigned elementByteSize) |
+ { |
+ return createOrNull(WTF::ArrayBuffer::createOrNull(numElements, elementByteSize)); |
+ } |
+ static PassRefPtr<DOMArrayBuffer> createOrNull(const void* source, unsigned byteLength) |
+ { |
+ return createOrNull(WTF::ArrayBuffer::createOrNull(source, byteLength)); |
+ } |
+ static PassRefPtr<DOMArrayBuffer> deprecatedCreateOrCrash(const void* source, unsigned byteLength) |
{ |
- return create(WTF::ArrayBuffer::create(numElements, elementByteSize)); |
+ return create(WTF::ArrayBuffer::deprecatedCreateOrCrash(source, byteLength)); |
} |
- static PassRefPtr<DOMArrayBuffer> create(const void* source, unsigned byteLength) |
+ static PassRefPtr<DOMArrayBuffer> deprecatedCreateOrCrash(unsigned numElements, unsigned elementByteSize) |
{ |
- return create(WTF::ArrayBuffer::create(source, byteLength)); |
+ return create(WTF::ArrayBuffer::deprecatedCreateOrCrash(numElements, elementByteSize)); |
} |
static PassRefPtr<DOMArrayBuffer> create(WTF::ArrayBufferContents& contents) |
{ |
- return create(WTF::ArrayBuffer::create(contents)); |
+ return adoptRef(new DOMArrayBuffer(WTF::ArrayBuffer::create(contents))); |
+ } |
+ static PassRefPtr<DOMArrayBuffer> create(PassRefPtr<WTF::ArrayBuffer> buffer) |
+ { |
+ ASSERT(buffer); |
+ return adoptRef(new DOMArrayBuffer(buffer)); |
} |
- |
// Only for use by XMLHttpRequest::responseArrayBuffer and |
// Internals::serializeObject. |
- static PassRefPtr<DOMArrayBuffer> createUninitialized(unsigned numElements, unsigned elementByteSize) |
+ static PassRefPtr<DOMArrayBuffer> createUninitializedOrNull(unsigned numElements, unsigned elementByteSize) |
{ |
- return create(WTF::ArrayBuffer::createUninitialized(numElements, elementByteSize)); |
+ return createOrNull(WTF::ArrayBuffer::createUninitializedOrNull(numElements, elementByteSize)); |
} |
- PassRefPtr<DOMArrayBuffer> slice(int begin, int end) const |
+ PassRefPtr<DOMArrayBuffer> sliceOrNull(int begin, int end) const |
{ |
- return create(buffer()->slice(begin, end)); |
+ return createOrNull(buffer()->sliceOrNull(begin, end)); |
} |
- PassRefPtr<DOMArrayBuffer> slice(int begin) const |
+ PassRefPtr<DOMArrayBuffer> sliceOrNull(int begin) const |
{ |
- return create(buffer()->slice(begin)); |
+ return createOrNull(buffer()->sliceOrNull(begin)); |
} |
v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationContext) override; |