OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ | 5 #ifndef MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ |
6 #define MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ | 6 #define MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "mojo/edk/system/system_impl_export.h" | 9 #include "mojo/edk/system/system_impl_export.h" |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 Type type = Type::POSIX; | 52 Type type = Type::POSIX; |
53 | 53 |
54 int handle = -1; | 54 int handle = -1; |
55 | 55 |
56 #if defined(OS_MACOSX) && !defined(OS_IOS) | 56 #if defined(OS_MACOSX) && !defined(OS_IOS) |
57 mach_port_t port = MACH_PORT_NULL; | 57 mach_port_t port = MACH_PORT_NULL; |
58 #endif | 58 #endif |
59 }; | 59 }; |
60 #elif defined(OS_WIN) | 60 #elif defined(OS_WIN) |
61 struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle { | 61 struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle { |
62 PlatformHandle() : handle(INVALID_HANDLE_VALUE) {} | 62 PlatformHandle() : PlatformHandle(INVALID_HANDLE_VALUE) {} |
63 explicit PlatformHandle(HANDLE handle) | 63 explicit PlatformHandle(HANDLE handle) |
64 : handle(handle), owning_process(base::GetCurrentProcessHandle()) {} | 64 : handle(handle), owning_process(base::GetCurrentProcessHandle()) {} |
65 | 65 |
66 void CloseIfNecessary(); | 66 void CloseIfNecessary(); |
67 | 67 |
68 bool is_valid() const { return handle != INVALID_HANDLE_VALUE; } | 68 bool is_valid() const { return handle != INVALID_HANDLE_VALUE; } |
69 | 69 |
70 HANDLE handle; | 70 HANDLE handle; |
71 | 71 |
72 // A Windows HANDLE may be duplicated to another process but not yet sent to | 72 // A Windows HANDLE may be duplicated to another process but not yet sent to |
73 // that process. This tracks the handle's owning process. | 73 // that process. This tracks the handle's owning process. |
74 base::ProcessHandle owning_process; | 74 base::ProcessHandle owning_process; |
75 }; | 75 }; |
76 #else | 76 #else |
77 #error "Platform not yet supported." | 77 #error "Platform not yet supported." |
78 #endif | 78 #endif |
79 | 79 |
80 } // namespace edk | 80 } // namespace edk |
81 } // namespace mojo | 81 } // namespace mojo |
82 | 82 |
83 #endif // MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ | 83 #endif // MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ |
OLD | NEW |