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

Side by Side Diff: third_party/WebKit/Source/core/dom/DOMArrayBuffer.h

Issue 2730943002: XMLHttpRequest: return null upon failing responseArrayBuffer allocation. (Closed)
Patch Set: mirror updated spec, and return |null| for failed allocs Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/DOMArrayBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DOMArrayBuffer_h 5 #ifndef DOMArrayBuffer_h
6 #define DOMArrayBuffer_h 6 #define DOMArrayBuffer_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/dom/DOMArrayBufferBase.h" 9 #include "core/dom/DOMArrayBufferBase.h"
10 #include "wtf/typed_arrays/ArrayBuffer.h" 10 #include "wtf/typed_arrays/ArrayBuffer.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 static DOMArrayBuffer* create(const void* source, unsigned byteLength) { 25 static DOMArrayBuffer* create(const void* source, unsigned byteLength) {
26 return create(WTF::ArrayBuffer::create(source, byteLength)); 26 return create(WTF::ArrayBuffer::create(source, byteLength));
27 } 27 }
28 static DOMArrayBuffer* create(WTF::ArrayBufferContents& contents) { 28 static DOMArrayBuffer* create(WTF::ArrayBufferContents& contents) {
29 return create(WTF::ArrayBuffer::create(contents)); 29 return create(WTF::ArrayBuffer::create(contents));
30 } 30 }
31 31
32 // Only for use by XMLHttpRequest::responseArrayBuffer and 32 // Only for use by XMLHttpRequest::responseArrayBuffer and
33 // Internals::serializeObject. 33 // Internals::serializeObject.
34 static DOMArrayBuffer* createUninitialized(unsigned numElements, 34 static DOMArrayBuffer* createUninitializedOrNull(unsigned numElements,
35 unsigned elementByteSize) { 35 unsigned elementByteSize);
36 return create(
37 WTF::ArrayBuffer::createUninitialized(numElements, elementByteSize));
38 }
39 36
40 DOMArrayBuffer* slice(int begin, int end) const { 37 DOMArrayBuffer* slice(int begin, int end) const {
41 return create(buffer()->slice(begin, end)); 38 return create(buffer()->slice(begin, end));
42 } 39 }
43 DOMArrayBuffer* slice(int begin) const { 40 DOMArrayBuffer* slice(int begin) const {
44 return create(buffer()->slice(begin)); 41 return create(buffer()->slice(begin));
45 } 42 }
46 43
47 v8::Local<v8::Object> wrap(v8::Isolate*, 44 v8::Local<v8::Object> wrap(v8::Isolate*,
48 v8::Local<v8::Object> creationContext) override; 45 v8::Local<v8::Object> creationContext) override;
49 46
50 private: 47 private:
51 explicit DOMArrayBuffer(PassRefPtr<WTF::ArrayBuffer> buffer) 48 explicit DOMArrayBuffer(PassRefPtr<WTF::ArrayBuffer> buffer)
52 : DOMArrayBufferBase(std::move(buffer)) {} 49 : DOMArrayBufferBase(std::move(buffer)) {}
53 }; 50 };
54 51
55 } // namespace blink 52 } // namespace blink
56 53
57 #endif // DOMArrayBuffer_h 54 #endif // DOMArrayBuffer_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/DOMArrayBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698