summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi/host_array_buffer_var.cc
blob: c8266df38b03679b70f0dd495597687d2a6fbe2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2012 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 "webkit/plugins/ppapi/host_array_buffer_var.h"

using ppapi::ArrayBufferVar;
using WebKit::WebArrayBuffer;

namespace webkit {
namespace ppapi {

HostArrayBufferVar::HostArrayBufferVar(uint32 size_in_bytes)
    : buffer_(WebArrayBuffer::create(size_in_bytes, 1 /* element_size */)) {
}

HostArrayBufferVar::HostArrayBufferVar(const WebArrayBuffer& buffer)
    : buffer_(buffer) {
}

HostArrayBufferVar::~HostArrayBufferVar() {
}

void* HostArrayBufferVar::Map() {
  return buffer_.data();
}

void HostArrayBufferVar::Unmap() {
  // We do not used shared memory on the host side. Nothing to do.
}

uint32 HostArrayBufferVar::ByteLength() {
  return buffer_.byteLength();
}

}  // namespace ppapi
}  // namespace webkit