blob: ff0bc933dbc08f116bd533d5359fc543a6c2ff1f [file] [log] [blame]
[email protected]8c197e502012-11-20 20:32:301// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "remoting/base/shared_buffer.h"
6
7const bool kReadOnly = true;
8
9namespace remoting {
10
11SharedBuffer::SharedBuffer(uint32 size)
12 : id_(0),
13 size_(size) {
14 shared_memory_.CreateAndMapAnonymous(size);
15}
16
17SharedBuffer::SharedBuffer(
[email protected]ff72dd12012-11-27 05:18:2518 int id, base::SharedMemoryHandle handle, uint32 size)
[email protected]8c197e502012-11-20 20:32:3019 : id_(id),
20 shared_memory_(handle, kReadOnly),
21 size_(size) {
22 shared_memory_.Map(size);
23}
24
25SharedBuffer::SharedBuffer(
[email protected]ff72dd12012-11-27 05:18:2526 int id, base::SharedMemoryHandle handle, base::ProcessHandle process,
[email protected]8c197e502012-11-20 20:32:3027 uint32 size)
28 : id_(id),
29 shared_memory_(handle, kReadOnly, process),
30 size_(size) {
31 shared_memory_.Map(size);
32}
33
34SharedBuffer::~SharedBuffer() {
35}
36
37} // namespace remoting