OLD | NEW |
(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 // This file contains implementations for the platform handle thunks |
| 6 // (see //mojo/public/platform/native/platform_handle_private.h) |
| 7 |
| 8 #include "base/logging.h" |
| 9 #include "mojo/edk/embedder/embedder.h" |
| 10 #include "mojo/public/platform/native/platform_handle_private.h" |
| 11 |
| 12 using mojo::platform::PlatformHandle; |
| 13 using mojo::platform::ScopedPlatformHandle; |
| 14 |
| 15 MojoResult MojoCreatePlatformHandleWrapper(MojoPlatformHandle platform_handle, |
| 16 MojoHandle* wrapper) { |
| 17 PlatformHandle platform_handle_wrapper(platform_handle); |
| 18 ScopedPlatformHandle scoped_platform_handle(platform_handle_wrapper); |
| 19 return mojo::embedder::CreatePlatformHandleWrapper( |
| 20 scoped_platform_handle.Pass(), wrapper); |
| 21 } |
| 22 |
| 23 MojoResult MojoExtractPlatformHandle(MojoHandle wrapper, |
| 24 MojoPlatformHandle* platform_handle) { |
| 25 ScopedPlatformHandle scoped_platform_handle; |
| 26 MojoResult result = mojo::embedder::PassWrappedPlatformHandle( |
| 27 wrapper, &scoped_platform_handle); |
| 28 if (result != MOJO_RESULT_OK) |
| 29 return result; |
| 30 |
| 31 DCHECK(scoped_platform_handle.is_valid()); |
| 32 *platform_handle = scoped_platform_handle.release().fd; |
| 33 return MOJO_RESULT_OK; |
| 34 } |
OLD | NEW |