OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/memory/shared_memory_handle.h" | 5 #include "base/memory/shared_memory_handle.h" |
6 | 6 |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/posix/eintr_wrapper.h" | 10 #include "base/posix/eintr_wrapper.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 | 13 |
14 SharedMemoryHandle::SharedMemoryHandle() = default; | 14 SharedMemoryHandle::SharedMemoryHandle() = default; |
| 15 SharedMemoryHandle::SharedMemoryHandle(const SharedMemoryHandle& handle) = |
| 16 default; |
| 17 SharedMemoryHandle& SharedMemoryHandle::operator=( |
| 18 const SharedMemoryHandle& handle) = default; |
15 | 19 |
16 SharedMemoryHandle::SharedMemoryHandle( | 20 SharedMemoryHandle::SharedMemoryHandle( |
17 const base::FileDescriptor& file_descriptor) | 21 const base::FileDescriptor& file_descriptor) |
18 : file_descriptor_(file_descriptor) {} | 22 : file_descriptor_(file_descriptor) {} |
19 | 23 |
20 // static | 24 // static |
21 SharedMemoryHandle SharedMemoryHandle::ImportHandle(int fd) { | 25 SharedMemoryHandle SharedMemoryHandle::ImportHandle(int fd) { |
22 SharedMemoryHandle handle; | 26 SharedMemoryHandle handle; |
23 handle.file_descriptor_.fd = fd; | 27 handle.file_descriptor_.fd = fd; |
24 handle.file_descriptor_.auto_close = false; | 28 handle.file_descriptor_.auto_close = false; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 64 |
61 void SharedMemoryHandle::SetOwnershipPassesToIPC(bool ownership_passes) { | 65 void SharedMemoryHandle::SetOwnershipPassesToIPC(bool ownership_passes) { |
62 file_descriptor_.auto_close = ownership_passes; | 66 file_descriptor_.auto_close = ownership_passes; |
63 } | 67 } |
64 | 68 |
65 bool SharedMemoryHandle::OwnershipPassesToIPC() const { | 69 bool SharedMemoryHandle::OwnershipPassesToIPC() const { |
66 return file_descriptor_.auto_close; | 70 return file_descriptor_.auto_close; |
67 } | 71 } |
68 | 72 |
69 } // namespace base | 73 } // namespace base |
OLD | NEW |