OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // 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 | 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 #include "remoting/capturer/shared_buffer.h" | 5 #include "media/video/capture/screen/shared_buffer.h" |
6 | 6 |
7 const bool kReadOnly = true; | 7 const bool kReadOnly = true; |
8 | 8 |
9 namespace remoting { | 9 namespace media { |
10 | 10 |
11 SharedBuffer::SharedBuffer(uint32 size) | 11 SharedBuffer::SharedBuffer(uint32 size) |
12 : id_(0), | 12 : id_(0), |
13 size_(size) { | 13 size_(size) { |
14 shared_memory_.CreateAndMapAnonymous(size); | 14 shared_memory_.CreateAndMapAnonymous(size); |
15 } | 15 } |
16 | 16 |
17 SharedBuffer::SharedBuffer( | 17 SharedBuffer::SharedBuffer( |
18 int id, base::SharedMemoryHandle handle, uint32 size) | 18 int id, base::SharedMemoryHandle handle, uint32 size) |
19 : id_(id), | 19 : id_(id), |
20 shared_memory_(handle, kReadOnly), | 20 shared_memory_(handle, kReadOnly), |
21 size_(size) { | 21 size_(size) { |
22 shared_memory_.Map(size); | 22 shared_memory_.Map(size); |
23 } | 23 } |
24 | 24 |
25 SharedBuffer::SharedBuffer( | 25 SharedBuffer::SharedBuffer( |
26 int id, base::SharedMemoryHandle handle, base::ProcessHandle process, | 26 int id, base::SharedMemoryHandle handle, base::ProcessHandle process, |
27 uint32 size) | 27 uint32 size) |
28 : id_(id), | 28 : id_(id), |
29 shared_memory_(handle, kReadOnly, process), | 29 shared_memory_(handle, kReadOnly, process), |
30 size_(size) { | 30 size_(size) { |
31 shared_memory_.Map(size); | 31 shared_memory_.Map(size); |
32 } | 32 } |
33 | 33 |
34 SharedBuffer::~SharedBuffer() { | 34 SharedBuffer::~SharedBuffer() { |
35 } | 35 } |
36 | 36 |
37 } // namespace remoting | 37 bool SharedBuffer::ShareToProcess(base::ProcessHandle process, |
| 38 base::SharedMemoryHandle* new_handle) { |
| 39 return shared_memory_.ShareToProcess(process, new_handle); |
| 40 } |
| 41 |
| 42 } // namespace media |
OLD | NEW |