Chromium Code Reviews| 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..bd363845fb61c7d28b13e2d98ba85f021dc02584 |
| --- /dev/null |
| +++ b/shell/platform_handle_impl.cc |
| @@ -0,0 +1,34 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
|
viettrungluu
2016/02/18 01:11:03
2016
Forrest Reiling
2016/02/23 23:48:45
Done.
|
| +// 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; |
| +} |