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 "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 private: | 68 private: |
69 HANDLE handle_; | 69 HANDLE handle_; |
70 | 70 |
71 // The process in which |handle_| is valid and can be used. If |handle_| is | 71 // The process in which |handle_| is valid and can be used. If |handle_| is |
72 // invalid, this will be kNullProcessId. | 72 // invalid, this will be kNullProcessId. |
73 base::ProcessId pid_; | 73 base::ProcessId pid_; |
74 }; | 74 }; |
75 #else | 75 #else |
76 class BASE_EXPORT SharedMemoryHandle { | 76 class BASE_EXPORT SharedMemoryHandle { |
77 public: | 77 public: |
| 78 // The values of these enums must not change, as they are used by the |
| 79 // histogram OSX.SharedMemory.Mechanism. |
78 enum Type { | 80 enum Type { |
79 // The SharedMemoryHandle is backed by a POSIX fd. | 81 // The SharedMemoryHandle is backed by a POSIX fd. |
80 POSIX, | 82 POSIX, |
81 // The SharedMemoryHandle is backed by the Mach primitive "memory object". | 83 // The SharedMemoryHandle is backed by the Mach primitive "memory object". |
82 MACH, | 84 MACH, |
83 }; | 85 }; |
| 86 static const int TypeMax = 2; |
84 | 87 |
85 // The format that should be used to transmit |Type| over the wire. | 88 // The format that should be used to transmit |Type| over the wire. |
86 typedef int TypeWireFormat; | 89 typedef int TypeWireFormat; |
87 | 90 |
88 // The default constructor returns an invalid SharedMemoryHandle. | 91 // The default constructor returns an invalid SharedMemoryHandle. |
89 SharedMemoryHandle(); | 92 SharedMemoryHandle(); |
90 | 93 |
91 // Constructs a SharedMemoryHandle backed by the components of a | 94 // Constructs a SharedMemoryHandle backed by the components of a |
92 // FileDescriptor. The newly created instance has the same ownership semantics | 95 // FileDescriptor. The newly created instance has the same ownership semantics |
93 // as base::FileDescriptor. This typically means that the SharedMemoryHandle | 96 // as base::FileDescriptor. This typically means that the SharedMemoryHandle |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // Defaults to |false|. | 190 // Defaults to |false|. |
188 bool ownership_passes_to_ipc_; | 191 bool ownership_passes_to_ipc_; |
189 }; | 192 }; |
190 }; | 193 }; |
191 }; | 194 }; |
192 #endif | 195 #endif |
193 | 196 |
194 } // namespace base | 197 } // namespace base |
195 | 198 |
196 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ | 199 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ |
OLD | NEW |