| 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) | 12 #if defined(OS_WIN) |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 namespace mojo { | 16 namespace mojo { |
| 17 namespace edk { | 17 namespace edk { |
| 18 | 18 |
| 19 struct NamedPlatformHandle; | 19 struct NamedPlatformHandle; |
| 20 | 20 |
| 21 #if defined(OS_POSIX) |
| 22 |
| 23 // The maximum length of the name of a unix domain socket. The standard size on |
| 24 // linux is 108, mac is 104. To maintain consistency across platforms we |
| 25 // standardize on the smaller value. |
| 26 const size_t kMaxSocketNameLength = 104; |
| 27 |
| 28 #endif |
| 29 |
| 21 struct CreateServerHandleOptions { | 30 struct CreateServerHandleOptions { |
| 22 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 23 // If true, creating a server handle will fail if another pipe with the same | 32 // If true, creating a server handle will fail if another pipe with the same |
| 24 // name exists. | 33 // name exists. |
| 25 bool enforce_uniqueness = true; | 34 bool enforce_uniqueness = true; |
| 26 | 35 |
| 27 // If non-empty, a security descriptor to use when creating the pipe. If | 36 // If non-empty, a security descriptor to use when creating the pipe. If |
| 28 // empty, a default security descriptor will be used. See | 37 // empty, a default security descriptor will be used. See |
| 29 // kDefaultSecurityDescriptor in named_platform_handle_utils_win.cc. | 38 // kDefaultSecurityDescriptor in named_platform_handle_utils_win.cc. |
| 30 base::string16 security_descriptor; | 39 base::string16 security_descriptor; |
| 31 #endif | 40 #endif |
| 32 }; | 41 }; |
| 33 | 42 |
| 34 // Creates a client platform handle from |handle|. This may block until |handle| | 43 // Creates a client platform handle from |handle|. This may block until |handle| |
| 35 // is ready to receive connections. | 44 // is ready to receive connections. |
| 36 MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle | 45 MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle |
| 37 CreateClientHandle(const NamedPlatformHandle& handle); | 46 CreateClientHandle(const NamedPlatformHandle& handle); |
| 38 | 47 |
| 39 // Creates a server platform handle from |handle|. | 48 // Creates a server platform handle from |handle|. |
| 40 MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle | 49 MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle |
| 41 CreateServerHandle(const NamedPlatformHandle& handle, | 50 CreateServerHandle(const NamedPlatformHandle& handle, |
| 42 const CreateServerHandleOptions& options = {}); | 51 const CreateServerHandleOptions& options = {}); |
| 43 | 52 |
| 44 } // namespace edk | 53 } // namespace edk |
| 45 } // namespace mojo | 54 } // namespace mojo |
| 46 | 55 |
| 47 #endif // MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_ | 56 #endif // MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_ |
| OLD | NEW |