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

Unified Diff: shell/platform_handle_impl.cc

Issue 1578423002: Added PlatformHandle thunks. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 4 years, 10 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
« no previous file with comments | « shell/native_application_support.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/platform_handle_impl.cc
diff --git a/shell/platform_handle_impl.cc b/shell/platform_handle_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1c1cfea858260ffde20c917996b10515392201eb
--- /dev/null
+++ b/shell/platform_handle_impl.cc
@@ -0,0 +1,34 @@
+// 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.
+
+// This file contains implementations for the platform handle thunks
+// (see //mojo/public/platform/native/platform_handle_private.h)
+
+#include "base/logging.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/public/platform/native/platform_handle_private.h"
+
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
+
+MojoResult MojoCreatePlatformHandleWrapper(MojoPlatformHandle platform_handle,
+ MojoHandle* wrapper) {
+ PlatformHandle platform_handle_wrapper(platform_handle);
+ ScopedPlatformHandle scoped_platform_handle(platform_handle_wrapper);
+ return mojo::embedder::CreatePlatformHandleWrapper(
+ scoped_platform_handle.Pass(), wrapper);
+}
+
+MojoResult MojoExtractPlatformHandle(MojoHandle wrapper,
+ MojoPlatformHandle* platform_handle) {
+ ScopedPlatformHandle scoped_platform_handle;
+ MojoResult result = mojo::embedder::PassWrappedPlatformHandle(
+ wrapper, &scoped_platform_handle);
+ if (result != MOJO_RESULT_OK)
+ return result;
+
+ DCHECK(scoped_platform_handle.is_valid());
+ *platform_handle = scoped_platform_handle.release().fd;
+ return MOJO_RESULT_OK;
+}
« no previous file with comments | « shell/native_application_support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698