OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef DOMSharedArrayBuffer_h | |
6 #define DOMSharedArrayBuffer_h | |
7 | |
8 #include "core/CoreExport.h" | |
9 #include "core/dom/DOMArrayBufferBase.h" | |
10 #include "wtf/ArrayBuffer.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class CORE_EXPORT DOMSharedArrayBuffer final : public DOMArrayBufferBase { | |
15 DEFINE_WRAPPERTYPEINFO(); | |
16 public: | |
17 static PassRefPtr<DOMSharedArrayBuffer> create(PassRefPtr<WTF::ArrayBuffer> buffer) | |
18 { | |
19 // TODO(binji): Would be nice to be able to check this at compile time. | |
20 ASSERT(buffer->isShared()); | |
21 return adoptRef(new DOMSharedArrayBuffer(buffer)); | |
22 } | |
23 static PassRefPtr<DOMSharedArrayBuffer> create(unsigned numElements, unsigne d elementByteSize) | |
24 { | |
25 return create(WTF::ArrayBuffer::createShared(numElements, elementByteSiz e)); | |
26 } | |
27 static PassRefPtr<DOMSharedArrayBuffer> create(const void* source, unsigned byteLength) | |
28 { | |
29 return create(WTF::ArrayBuffer::createShared(source, byteLength)); | |
30 } | |
31 static PassRefPtr<DOMSharedArrayBuffer> create(WTF::ArrayBufferContents& con tents) | |
32 { | |
33 // TODO(binji): Would be nice to be able to check this at compile time. | |
34 ASSERT(contents.isShared()); | |
35 return create(WTF::ArrayBuffer::create(contents)); | |
36 } | |
37 | |
38 virtual v8::Handle<v8::Object> wrap(v8::Isolate*, v8::Handle<v8::Object> cre ationContext) override; | |
Yuki
2015/06/09 06:18:07
nit: 'virtual' is no longer needed when you have '
binji
2015/06/10 06:04:39
Done.
| |
39 virtual v8::Handle<v8::Object> associateWithWrapper(v8::Isolate*, const Wrap perTypeInfo*, v8::Handle<v8::Object> wrapper) override; | |
40 | |
41 private: | |
42 explicit DOMSharedArrayBuffer(PassRefPtr<WTF::ArrayBuffer> buffer) | |
43 : DOMArrayBufferBase(buffer) | |
44 { | |
45 } | |
46 }; | |
47 | |
48 } // namespace blink | |
49 | |
50 #endif // DOMSharedArrayBuffer_h | |
OLD | NEW |