Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: mojo/edk/embedder/named_platform_handle.h

Issue 2282413004: Support creating mojo peer connections from named pipes. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_H_
6 #define MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_H_
7
8 #include <string>
9
10 #include "base/strings/string16.h"
11 #include "base/strings/string_piece.h"
12 #include "base/strings/utf_string_conversions.h"
13 #include "build/build_config.h"
14 #include "mojo/edk/system/system_impl_export.h"
15
16 namespace mojo {
17 namespace edk {
18
19 #if defined(OS_POSIX)
20 struct MOJO_SYSTEM_IMPL_EXPORT NamedPlatformHandle {
21 NamedPlatformHandle() {}
22 explicit NamedPlatformHandle(const base::StringPiece& name)
23 : name(name.as_string()) {}
24
25 bool is_valid() const { return !name.empty(); }
26
27 std::string name;
28 };
29 #elif defined(OS_WIN)
30 struct MOJO_SYSTEM_IMPL_EXPORT NamedPlatformHandle {
31 NamedPlatformHandle() {}
32 explicit NamedPlatformHandle(const base::StringPiece& name)
33 : name(base::UTF8ToUTF16(name)) {}
34
35 explicit NamedPlatformHandle(const base::StringPiece16& name)
36 : name(name.as_string()) {}
37
38 bool is_valid() const { return !name.empty(); }
39
40 base::string16 pipe_name() const { return L"\\\\.\\pipe\\mojo." + name; }
41
42 base::string16 name;
43 };
44 #else
45 #error "Platform not yet supported."
46 #endif
47
48 } // namespace edk
49 } // namespace mojo
50
51 #endif // MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_H_
OLDNEW
« no previous file with comments | « mojo/edk/embedder/named_platform_channel_pair_win.cc ('k') | mojo/edk/embedder/named_platform_handle_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698