OLD | NEW |
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 "platform/wtf/typed_arrays/ArrayBuffer.h" | 10 #include "platform/wtf/typed_arrays/ArrayBuffer.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 static DOMSharedArrayBuffer* Create(const void* source, | 27 static DOMSharedArrayBuffer* Create(const void* source, |
28 unsigned byte_length) { | 28 unsigned byte_length) { |
29 return Create(WTF::ArrayBuffer::CreateShared(source, byte_length)); | 29 return Create(WTF::ArrayBuffer::CreateShared(source, byte_length)); |
30 } | 30 } |
31 static DOMSharedArrayBuffer* Create(WTF::ArrayBufferContents& contents) { | 31 static DOMSharedArrayBuffer* Create(WTF::ArrayBufferContents& contents) { |
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 bool ShareContentsWith(WTF::ArrayBufferContents& result) { |
| 37 return Buffer()->ShareContentsWith(result); |
| 38 } |
| 39 |
36 v8::Local<v8::Object> Wrap(v8::Isolate*, | 40 v8::Local<v8::Object> Wrap(v8::Isolate*, |
37 v8::Local<v8::Object> creation_context) override; | 41 v8::Local<v8::Object> creation_context) override; |
38 | 42 |
39 private: | 43 private: |
40 explicit DOMSharedArrayBuffer(PassRefPtr<WTF::ArrayBuffer> buffer) | 44 explicit DOMSharedArrayBuffer(PassRefPtr<WTF::ArrayBuffer> buffer) |
41 : DOMArrayBufferBase(std::move(buffer)) {} | 45 : DOMArrayBufferBase(std::move(buffer)) {} |
42 }; | 46 }; |
43 | 47 |
44 } // namespace blink | 48 } // namespace blink |
45 | 49 |
46 #endif // DOMSharedArrayBuffer_h | 50 #endif // DOMSharedArrayBuffer_h |
OLD | NEW |