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) |
11 #include <windows.h> | 11 #include <windows.h> |
12 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 12 #elif defined(OS_MACOSX) |
13 #include <sys/types.h> | 13 #include <sys/types.h> |
14 #include "base/base_export.h" | 14 #include "base/base_export.h" |
15 #include "base/file_descriptor_posix.h" | 15 #include "base/file_descriptor_posix.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #elif defined(OS_POSIX) | 17 #elif defined(OS_POSIX) |
18 #include <sys/types.h> | 18 #include <sys/types.h> |
19 #include "base/file_descriptor_posix.h" | 19 #include "base/file_descriptor_posix.h" |
20 #endif | 20 #endif |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 | 23 |
24 class Pickle; | 24 class Pickle; |
25 | 25 |
26 // SharedMemoryHandle is a platform specific type which represents | 26 // SharedMemoryHandle is a platform specific type which represents |
27 // the underlying OS handle to a shared memory segment. | 27 // the underlying OS handle to a shared memory segment. |
28 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
29 typedef HANDLE SharedMemoryHandle; | 29 typedef HANDLE SharedMemoryHandle; |
30 #elif defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS)) | 30 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
31 typedef FileDescriptor SharedMemoryHandle; | 31 typedef FileDescriptor SharedMemoryHandle; |
32 #else | 32 #else |
33 class BASE_EXPORT SharedMemoryHandle { | 33 class BASE_EXPORT SharedMemoryHandle { |
34 public: | 34 public: |
35 enum Type { | 35 enum Type { |
36 // Indicates that the SharedMemoryHandle is backed by a POSIX fd. | 36 // Indicates that the SharedMemoryHandle is backed by a POSIX fd. |
37 POSIX, | 37 POSIX, |
38 // Indicates that the SharedMemoryHandle is backed by the Mach primitive | 38 // Indicates that the SharedMemoryHandle is backed by the Mach primitive |
39 // "memory object". | 39 // "memory object". |
40 MACH, | 40 MACH, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 private: | 89 private: |
90 Type type_; | 90 Type type_; |
91 FileDescriptor file_descriptor_; | 91 FileDescriptor file_descriptor_; |
92 }; | 92 }; |
93 #endif | 93 #endif |
94 | 94 |
95 } // namespace base | 95 } // namespace base |
96 | 96 |
97 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ | 97 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ |
OLD | NEW |