OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_NAMED_PLATFORM_HANDLE_UTILS_H_ | 5 #ifndef MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_ |
6 #define MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_ | 6 #define MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "mojo/edk/embedder/scoped_platform_handle.h" | 9 #include "mojo/edk/embedder/scoped_platform_handle.h" |
10 #include "mojo/edk/system/system_impl_export.h" | 10 #include "mojo/edk/system/system_impl_export.h" |
11 | 11 |
| 12 #if defined(OS_WIN) |
| 13 #include "base/strings/string16.h" |
| 14 #endif |
| 15 |
12 namespace mojo { | 16 namespace mojo { |
13 namespace edk { | 17 namespace edk { |
14 | 18 |
15 struct NamedPlatformHandle; | 19 struct NamedPlatformHandle; |
16 | 20 |
| 21 struct CreateServerHandleOptions { |
| 22 #if defined(OS_WIN) |
| 23 // If true, creating a server handle will fail if another pipe with the same |
| 24 // name exists. |
| 25 bool enforce_uniqueness = true; |
| 26 |
| 27 // If non-empty, a security descriptor to use when creating the pipe. If |
| 28 // empty, a default security descriptor will be used. See |
| 29 // kDefaultSecurityDescriptor in named_platform_handle_utils_win.cc. |
| 30 base::string16 security_descriptor; |
| 31 #endif |
| 32 }; |
| 33 |
17 // Creates a client platform handle from |handle|. This may block until |handle| | 34 // Creates a client platform handle from |handle|. This may block until |handle| |
18 // is ready to receive connections. | 35 // is ready to receive connections. |
19 MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle | 36 MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle |
20 CreateClientHandle(const NamedPlatformHandle& handle); | 37 CreateClientHandle(const NamedPlatformHandle& handle); |
21 | 38 |
22 // Creates a server platform handle from |handle|. On Windows, if | 39 // Creates a server platform handle from |handle|. |
23 // |enforce_uniqueness| is true, this will fail if another pipe with the same | |
24 // name exists. On other platforms, |enforce_uniqueness| must be false. | |
25 MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle | 40 MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle |
26 CreateServerHandle(const NamedPlatformHandle& handle, bool enforce_uniqueness); | 41 CreateServerHandle(const NamedPlatformHandle& handle, |
| 42 const CreateServerHandleOptions& options = {}); |
27 | 43 |
28 } // namespace edk | 44 } // namespace edk |
29 } // namespace mojo | 45 } // namespace mojo |
30 | 46 |
31 #endif // MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_ | 47 #endif // MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_ |
OLD | NEW |