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. | |
80 enum Type { | 78 enum Type { |
81 // The SharedMemoryHandle is backed by a POSIX fd. | 79 // The SharedMemoryHandle is backed by a POSIX fd. |
82 POSIX, | 80 POSIX, |
83 // The SharedMemoryHandle is backed by the Mach primitive "memory object". | 81 // The SharedMemoryHandle is backed by the Mach primitive "memory object". |
84 MACH, | 82 MACH, |
85 }; | 83 }; |
86 static const int TypeMax = 2; | |
87 | 84 |
88 // The format that should be used to transmit |Type| over the wire. | 85 // The format that should be used to transmit |Type| over the wire. |
89 typedef int TypeWireFormat; | 86 typedef int TypeWireFormat; |
90 | 87 |
91 // The default constructor returns an invalid SharedMemoryHandle. | 88 // The default constructor returns an invalid SharedMemoryHandle. |
92 SharedMemoryHandle(); | 89 SharedMemoryHandle(); |
93 | 90 |
94 // Constructs a SharedMemoryHandle backed by the components of a | 91 // Constructs a SharedMemoryHandle backed by the components of a |
95 // FileDescriptor. The newly created instance has the same ownership semantics | 92 // FileDescriptor. The newly created instance has the same ownership semantics |
96 // as base::FileDescriptor. This typically means that the SharedMemoryHandle | 93 // as base::FileDescriptor. This typically means that the SharedMemoryHandle |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // Defaults to |false|. | 187 // Defaults to |false|. |
191 bool ownership_passes_to_ipc_; | 188 bool ownership_passes_to_ipc_; |
192 }; | 189 }; |
193 }; | 190 }; |
194 }; | 191 }; |
195 #endif | 192 #endif |
196 | 193 |
197 } // namespace base | 194 } // namespace base |
198 | 195 |
199 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ | 196 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ |
OLD | NEW |