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

Unified Diff: mojo/edk/embedder/named_platform_handle.h

Issue 2282413004: Support creating mojo peer connections from named pipes. (Closed)
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: mojo/edk/embedder/named_platform_handle.h
diff --git a/mojo/edk/embedder/named_platform_handle.h b/mojo/edk/embedder/named_platform_handle.h
new file mode 100644
index 0000000000000000000000000000000000000000..15ca6565d51580a7e7f2fd58a2c7fc20e0a38256
--- /dev/null
+++ b/mojo/edk/embedder/named_platform_handle.h
@@ -0,0 +1,51 @@
+// 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_H_
+#define MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_H_
+
+#include <string>
+
+#include "base/strings/string16.h"
+#include "base/strings/string_piece.h"
+#include "base/strings/utf_string_conversions.h"
+#include "build/build_config.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+namespace mojo {
+namespace edk {
+
+#if defined(OS_POSIX)
+struct MOJO_SYSTEM_IMPL_EXPORT NamedPlatformHandle {
+ NamedPlatformHandle() {}
+ explicit NamedPlatformHandle(const base::StringPiece& name)
+ : name(name.as_string()) {}
+
+ bool is_valid() const { return !name.empty(); }
+
+ std::string name;
+};
+#elif defined(OS_WIN)
+struct MOJO_SYSTEM_IMPL_EXPORT NamedPlatformHandle {
+ NamedPlatformHandle() {}
+ explicit NamedPlatformHandle(const base::StringPiece& name)
+ : name(base::UTF8ToUTF16(name)) {}
+
+ explicit NamedPlatformHandle(const base::StringPiece16& name)
+ : name(name.as_string()) {}
+
+ bool is_valid() const { return !name.empty(); }
+
+ base::string16 pipe_name() const { return L"\\\\.\\pipe\\mojo." + name; }
+
+ base::string16 name;
+};
+#else
+#error "Platform not yet supported."
+#endif
+
+} // namespace edk
+} // namespace mojo
+
+#endif // MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_H_
« 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