summaryrefslogtreecommitdiff
path: root/mojo/edk/embedder/named_platform_handle_utils.h
diff options
context:
space:
mode:
authorHidehiko Abe <hidehiko@google.com>2018-04-23 20:01:13 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-04-23 20:01:13 -0700
commited7128dca79cff94e99465e3c1bc31d91d83c76d (patch)
treebd2d04362f66c36d4279f7a9735ba21ea3a2a021 /mojo/edk/embedder/named_platform_handle_utils.h
parentd6187ab7d79d95d101c2ecb83aa98c05bcdcccd1 (diff)
parent0ab20ac2283987e63b0e7c1318db2a5cf7c668d2 (diff)
downloadlibchrome-ed7128dca79cff94e99465e3c1bc31d91d83c76d.tar.gz
Migrate libmojo repository into libchrome, part 2. am: b268b43ac6
am: 0ab20ac228 Change-Id: I1b1afe0c902f1d122b100f5bf56d1df4a94eb090
Diffstat (limited to 'mojo/edk/embedder/named_platform_handle_utils.h')
-rw-r--r--mojo/edk/embedder/named_platform_handle_utils.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/mojo/edk/embedder/named_platform_handle_utils.h b/mojo/edk/embedder/named_platform_handle_utils.h
new file mode 100644
index 0000000000..b767ea0975
--- /dev/null
+++ b/mojo/edk/embedder/named_platform_handle_utils.h
@@ -0,0 +1,56 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_
+#define MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_
+
+#include "build/build_config.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+#if defined(OS_WIN)
+#include "base/strings/string16.h"
+#endif
+
+namespace mojo {
+namespace edk {
+
+struct NamedPlatformHandle;
+
+#if defined(OS_POSIX)
+
+// The maximum length of the name of a unix domain socket. The standard size on
+// linux is 108, mac is 104. To maintain consistency across platforms we
+// standardize on the smaller value.
+const size_t kMaxSocketNameLength = 104;
+
+#endif
+
+struct CreateServerHandleOptions {
+#if defined(OS_WIN)
+ // If true, creating a server handle will fail if another pipe with the same
+ // name exists.
+ bool enforce_uniqueness = true;
+
+ // If non-empty, a security descriptor to use when creating the pipe. If
+ // empty, a default security descriptor will be used. See
+ // kDefaultSecurityDescriptor in named_platform_handle_utils_win.cc.
+ base::string16 security_descriptor;
+#endif
+};
+
+// Creates a client platform handle from |handle|. This may block until |handle|
+// is ready to receive connections.
+MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle
+CreateClientHandle(const NamedPlatformHandle& handle);
+
+// Creates a server platform handle from |handle|.
+MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle
+CreateServerHandle(const NamedPlatformHandle& handle,
+ const CreateServerHandleOptions& options = {});
+
+} // namespace edk
+} // namespace mojo
+
+#endif // MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_