OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ | 5 #ifndef BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ |
6 #define BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ | 6 #define BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 void Close() const; | 49 void Close() const; |
50 | 50 |
51 // Whether ownership of the underlying OS resource is implicitly passed to | 51 // Whether ownership of the underlying OS resource is implicitly passed to |
52 // the IPC subsystem during serialization. | 52 // the IPC subsystem during serialization. |
53 void SetOwnershipPassesToIPC(bool ownership_passes); | 53 void SetOwnershipPassesToIPC(bool ownership_passes); |
54 bool OwnershipPassesToIPC() const; | 54 bool OwnershipPassesToIPC() const; |
55 | 55 |
56 // Whether the underlying OS resource is valid. | 56 // Whether the underlying OS resource is valid. |
57 bool IsValid() const; | 57 bool IsValid() const; |
58 | 58 |
59 // Duplicates the underlying OS resource. | 59 // Duplicates the underlying OS resource. Using the return value as a |
| 60 // parameter to an IPC message will cause the IPC subsystem to consume the OS |
| 61 // resource. |
60 SharedMemoryHandle Duplicate() const; | 62 SharedMemoryHandle Duplicate() const; |
61 | 63 |
62 #if defined(OS_MACOSX) && !defined(OS_IOS) | 64 #if defined(OS_MACOSX) && !defined(OS_IOS) |
63 enum Type { | 65 enum Type { |
64 // The SharedMemoryHandle is backed by a POSIX fd. | 66 // The SharedMemoryHandle is backed by a POSIX fd. |
65 POSIX, | 67 POSIX, |
66 // The SharedMemoryHandle is backed by the Mach primitive "memory object". | 68 // The SharedMemoryHandle is backed by the Mach primitive "memory object". |
67 MACH, | 69 MACH, |
68 }; | 70 }; |
69 | 71 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Defaults to |false|. | 181 // Defaults to |false|. |
180 bool ownership_passes_to_ipc_; | 182 bool ownership_passes_to_ipc_; |
181 #else | 183 #else |
182 FileDescriptor file_descriptor_; | 184 FileDescriptor file_descriptor_; |
183 #endif | 185 #endif |
184 }; | 186 }; |
185 | 187 |
186 } // namespace base | 188 } // namespace base |
187 | 189 |
188 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ | 190 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ |
OLD | NEW |