OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 #include "mojo/platform_handle/platform_handle_functions.h" | |
6 | |
7 #include <utility> | |
8 | |
9 #include "mojo/edk/embedder/embedder.h" | |
10 | |
11 extern "C" { | |
12 | |
13 MojoResult MojoCreatePlatformHandleWrapper(MojoPlatformHandle platform_handle, | |
14 MojoHandle* wrapper) { | |
15 mojo::edk::PlatformHandle platform_handle_wrapper(platform_handle); | |
16 mojo::edk::ScopedPlatformHandle scoped_platform_handle( | |
17 platform_handle_wrapper); | |
18 return mojo::edk::CreatePlatformHandleWrapper( | |
19 std::move(scoped_platform_handle), wrapper); | |
20 } | |
21 | |
22 MojoResult MojoExtractPlatformHandle(MojoHandle wrapper, | |
23 MojoPlatformHandle* platform_handle) { | |
24 mojo::edk::ScopedPlatformHandle scoped_platform_handle; | |
25 MojoResult result = | |
26 mojo::edk::PassWrappedPlatformHandle(wrapper, &scoped_platform_handle); | |
27 if (result != MOJO_RESULT_OK) | |
28 return result; | |
29 | |
30 DCHECK(scoped_platform_handle.is_valid()); | |
31 *platform_handle = scoped_platform_handle.release().handle; | |
32 return MOJO_RESULT_OK; | |
33 } | |
34 | |
35 } // extern "C" | |
OLD | NEW |