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..469c99c6b0b14d0fce56b2a3c1e05411f57eccca |
| --- /dev/null |
| +++ b/shell/platform_handle_impl.cc |
| @@ -0,0 +1,29 @@ |
| +// 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. |
| + |
|
viettrungluu
2016/02/02 00:07:36
This file could use a file-level comment, especial
Forrest Reiling
2016/02/10 20:16:09
Done.
|
| +#include "base/logging.h" |
| +#include "mojo/edk/embedder/embedder.h" |
| +#include "mojo/platform_handle/platform_handle_functions.h" |
| + |
|
viettrungluu
2016/02/02 00:07:36
Probably the contents of this file should be in th
Forrest Reiling
2016/02/10 20:16:09
As discussed, doing this is problematic because th
|
| +MojoResult MojoCreatePlatformHandleWrapper(MojoPlatformHandle platform_handle, |
| + MojoHandle* wrapper) { |
| + mojo::platform::PlatformHandle platform_handle_wrapper(platform_handle); |
|
viettrungluu
2016/02/02 00:07:36
I'd also add:
using mojo::platform::PlatformHandl
Forrest Reiling
2016/02/10 20:16:09
Done.
|
| + mojo::platform::ScopedPlatformHandle scoped_platform_handle( |
| + platform_handle_wrapper); |
| + return mojo::embedder::CreatePlatformHandleWrapper( |
| + scoped_platform_handle.Pass(), wrapper); |
| +} |
| + |
| +MojoResult MojoExtractPlatformHandle(MojoHandle wrapper, |
| + MojoPlatformHandle* platform_handle) { |
| + mojo::platform::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; |
| +} |