summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/plugin_array_buffer_var.cc
blob: c9d302fe8cb5a800b3994f97fa0b7b8499c4d828 (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
// 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 "ppapi/proxy/plugin_array_buffer_var.h"

#include <stdlib.h>

#include <limits>

namespace ppapi {

PluginArrayBufferVar::PluginArrayBufferVar(uint32 size_in_bytes)
    : buffer_(size_in_bytes) {
}

PluginArrayBufferVar::~PluginArrayBufferVar() {
}

void* PluginArrayBufferVar::Map() {
  if (buffer_.empty())
    return NULL;
  return &(buffer_[0]);
}

void PluginArrayBufferVar::Unmap() {
  // We don't actually use shared memory yet, so do nothing.
}

uint32 PluginArrayBufferVar::ByteLength() {
  return static_cast<uint32>(buffer_.size());
}

}  // namespace ppapi