forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
named_platform_handle_utils.h
56 lines (42 loc) · 1.74 KB
/
named_platform_handle_utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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_