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

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

Issue 1964183004: Revert of Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 DOMSharedArrayBuffer_h 5 #ifndef DOMSharedArrayBuffer_h
6 #define DOMSharedArrayBuffer_h 6 #define DOMSharedArrayBuffer_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/ArrayBuffer.h" 10 #include "wtf/ArrayBuffer.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class CORE_EXPORT DOMSharedArrayBuffer final : public DOMArrayBufferBase { 14 class CORE_EXPORT DOMSharedArrayBuffer final : public DOMArrayBufferBase {
15 DEFINE_WRAPPERTYPEINFO(); 15 DEFINE_WRAPPERTYPEINFO();
16 public: 16 public:
17 static DOMSharedArrayBuffer* create(PassRefPtr<WTF::ArrayBuffer> buffer) 17 static PassRefPtr<DOMSharedArrayBuffer> create(PassRefPtr<WTF::ArrayBuffer> buffer)
18 { 18 {
19 DCHECK(buffer->isShared()); 19 DCHECK(buffer->isShared());
20 return new DOMSharedArrayBuffer(buffer); 20 return adoptRef(new DOMSharedArrayBuffer(buffer));
21 } 21 }
22 static DOMSharedArrayBuffer* create(unsigned numElements, unsigned elementBy teSize) 22 static PassRefPtr<DOMSharedArrayBuffer> create(unsigned numElements, unsigne d elementByteSize)
23 { 23 {
24 return create(WTF::ArrayBuffer::createShared(numElements, elementByteSiz e)); 24 return create(WTF::ArrayBuffer::createShared(numElements, elementByteSiz e));
25 } 25 }
26 static DOMSharedArrayBuffer* create(const void* source, unsigned byteLength) 26 static PassRefPtr<DOMSharedArrayBuffer> create(const void* source, unsigned byteLength)
27 { 27 {
28 return create(WTF::ArrayBuffer::createShared(source, byteLength)); 28 return create(WTF::ArrayBuffer::createShared(source, byteLength));
29 } 29 }
30 static DOMSharedArrayBuffer* create(WTF::ArrayBufferContents& contents) 30 static PassRefPtr<DOMSharedArrayBuffer> create(WTF::ArrayBufferContents& con tents)
31 { 31 {
32 DCHECK(contents.isShared()); 32 DCHECK(contents.isShared());
33 return create(WTF::ArrayBuffer::create(contents)); 33 return create(WTF::ArrayBuffer::create(contents));
34 } 34 }
35 35
36 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte xt) override; 36 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte xt) override;
37 37
38 private: 38 private:
39 explicit DOMSharedArrayBuffer(PassRefPtr<WTF::ArrayBuffer> buffer) 39 explicit DOMSharedArrayBuffer(PassRefPtr<WTF::ArrayBuffer> buffer)
40 : DOMArrayBufferBase(buffer) 40 : DOMArrayBufferBase(buffer)
41 { 41 {
42 } 42 }
43 }; 43 };
44 44
45 } // namespace blink 45 } // namespace blink
46 46
47 #endif // DOMSharedArrayBuffer_h 47 #endif // DOMSharedArrayBuffer_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp ('k') | third_party/WebKit/Source/core/dom/DOMSharedArrayBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698