| Index: mojo/common/common_custom_types_struct_traits_win.cc
|
| diff --git a/mojo/common/common_custom_types_struct_traits_win.cc b/mojo/common/common_custom_types_struct_traits_win.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3e6808f9574f1bea8a0072e8920fc4119725ddf4
|
| --- /dev/null
|
| +++ b/mojo/common/common_custom_types_struct_traits_win.cc
|
| @@ -0,0 +1,31 @@
|
| +// 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.
|
| +
|
| +#include "mojo/common/common_custom_types_struct_traits_win.h"
|
| +
|
| +#include "mojo/public/cpp/system/platform_handle.h"
|
| +
|
| +namespace mojo {
|
| +
|
| +mojo::ScopedHandle StructTraits<
|
| + common::mojom::WindowsHandleDataView,
|
| + base::win::ScopedHandle>::wrapped_handle(base::win::ScopedHandle& handle) {
|
| + DCHECK(handle.IsValid());
|
| + return mojo::WrapPlatformFile(handle.Take());
|
| +}
|
| +
|
| +bool StructTraits<
|
| + common::mojom::WindowsHandleDataView,
|
| + base::win::ScopedHandle>::Read(common::mojom::WindowsHandleDataView data,
|
| + base::win::ScopedHandle* handle) {
|
| + base::PlatformFile platform_handle = base::kInvalidPlatformFile;
|
| + if (mojo::UnwrapPlatformFile(data.TakeWrappedHandle(), &platform_handle) !=
|
| + MOJO_RESULT_OK) {
|
| + return false;
|
| + }
|
| + *handle = base::win::ScopedHandle(platform_handle);
|
| + return true;
|
| +}
|
| +
|
| +} // namespace mojo
|
|
|