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

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

Issue 2826263002: Make DOMArrayBuffer::Transfer neuter v8::ArrayBuffers (Closed)
Patch Set: add test and use to_transfer Created 3 years, 8 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 "platform/wtf/typed_arrays/ArrayBuffer.h" 10 #include "platform/wtf/typed_arrays/ArrayBuffer.h"
(...skipping 15 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698