Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: mojo/common/common_custom_types_struct_traits.h

Issue 2524293002: Add a mojo struct corresponding and typemapped to base::File. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/common/common_custom_types.typemap ('k') | mojo/common/common_custom_types_struct_traits.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « mojo/common/common_custom_types.typemap ('k') | mojo/common/common_custom_types_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698