Chromium Code Reviews| Index: third_party/WebKit/Source/core/mojo/MojoSharedBuffer.cpp |
| diff --git a/third_party/WebKit/Source/core/mojo/MojoSharedBuffer.cpp b/third_party/WebKit/Source/core/mojo/MojoSharedBuffer.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e284be75b91a8c3d055a156257ac2679f2c7a951 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/mojo/MojoSharedBuffer.cpp |
| @@ -0,0 +1,26 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "core/mojo/MojoSharedBuffer.h" |
| + |
| +#include "core/dom/DOMArrayBuffer.h" |
| +#include "mojo/public/cpp/system/core.h" |
| + |
| +namespace blink { |
| + |
| +MojoSharedBuffer::MojoSharedBuffer(void* data, unsigned numBytes) |
| + : m_buffer(DOMArrayBuffer::create(data, numBytes)) { |
| + // TODO(alokp): We need to create an ArrayBuffer that does not own data. |
|
alokp
2017/02/27 19:50:45
jbroman@: I could not find a way to create an arra
jbroman
2017/02/27 20:14:44
blink::DOMArrayBufferBase doesn't presently suppor
alokp
2017/02/27 20:30:34
I think the latter - teaching DOMArrayBufferBase a
alokp
2017/02/28 00:22:15
A quick patch to support externalized ArrayBuffer:
|
| +} |
| + |
| +void MojoSharedBuffer::unmap() { |
| + MojoUnmapBuffer(m_buffer->data()); |
| + // TODO(alokp): Neuter m_buffer. |
|
alokp
2017/02/27 19:50:45
jbroman@: Is Neutering the correct thing to do her
jbroman
2017/02/27 20:14:44
Yes, probably.
|
| +} |
| + |
| +DEFINE_TRACE(MojoSharedBuffer) { |
| + visitor->trace(m_buffer); |
| +} |
| + |
| +} // namespace blink |