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

Unified Diff: mojo/runner/platform_handle_impl.cc

Issue 1113393002: Adds thunks for getting platform handles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/runner/platform_handle_impl.cc
diff --git a/mojo/runner/platform_handle_impl.cc b/mojo/runner/platform_handle_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5420620b1763b6f170844d481d2f31fa8ad43bce
--- /dev/null
+++ b/mojo/runner/platform_handle_impl.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 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.
+
+#include "mojo/platform_handle/platform_handle.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
+
+extern "C" {
+
+bool MojoCreatePlatformHandleWrapper(MojoPlatformHandle platform_handle,
+ MojoHandle* wrapper) {
+ mojo::embedder::PlatformHandle platform_handle_wrapper(platform_handle);
+ mojo::embedder::ScopedPlatformHandle scoped_platform_handle(
+ platform_handle_wrapper);
+ return mojo::embedder::CreatePlatformHandleWrapper(
+ scoped_platform_handle.Pass(), wrapper) == MOJO_RESULT_OK;
+}
+
+bool MojoExtractPlatformHandle(MojoHandle wrapper,
+ MojoPlatformHandle* platform_handle) {
+ mojo::embedder::ScopedPlatformHandle scoped_platform_handle;
+ if (mojo::embedder::PassWrappedPlatformHandle(
+ wrapper, &scoped_platform_handle) != MOJO_RESULT_OK)
+ return false;
+
+ DCHECK(scoped_platform_handle.is_valid());
+#if defined(OS_POSIX)
+ *platform_handle = scoped_platform_handle.release().fd;
+#elif defined(OS_WIN)
+ *platform_handle = scoped_platform_handle.release().handle;
+#else
+#error "Platform not yet supported."
+#endif
+ return true;
+}
+
+} // extern "C"
« mojo/platform_handle/platform_handle_thunks.h ('K') | « mojo/runner/native_application_support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698