Chromium Code Reviews| Index: mojo/common/common_custom_types_struct_traits.h |
| diff --git a/mojo/common/common_custom_types_struct_traits.h b/mojo/common/common_custom_types_struct_traits.h |
| index b99e15ffc9d803ff7e0aea30cfc60d671f01b007..39a424fac5152561b0d6273c752b564706319eaf 100644 |
| --- a/mojo/common/common_custom_types_struct_traits.h |
| +++ b/mojo/common/common_custom_types_struct_traits.h |
| @@ -5,6 +5,7 @@ |
| #ifndef MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_H_ |
| #define MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_H_ |
| +#include "base/files/file.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/unguessable_token.h" |
| #include "base/version.h" |
| @@ -68,6 +69,16 @@ struct StructTraits<common::mojom::TimeDeltaDataView, base::TimeDelta> { |
| } |
| }; |
| +template <> |
| +struct StructTraits<common::mojom::FileDataView, base::File> { |
| + static bool IsNull(const base::File& file) { return !file.IsValid(); } |
| + |
| + static void SetToNull(base::File* file) { *file = base::File(); } |
| + |
| + static mojo::ScopedHandle fd(base::File& file); |
|
dcheng
2016/11/28 17:25:07
Nit: const
Sam McNally
2016/11/28 21:21:47
It has to be non-const to TakePlatformFile().
|
| + static bool Read(common::mojom::FileDataView data, base::File* file); |
| +}; |
| + |
| } // namespace mojo |
| #endif // MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_H_ |