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

Unified Diff: mojo/common/common_custom_types_struct_traits.h

Issue 2561003002: Add mojo structs for ScopedFD and ScopedHandle. (Closed)
Patch Set: Created 4 years 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/BUILD.gn ('k') | mojo/common/common_custom_types_struct_traits_posix.h » ('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 c45ab90ca2b494ba1cc2417c728357e145636d73..25a7d64d633c44c3e945c1ea9b064d244875f340 100644
--- a/mojo/common/common_custom_types_struct_traits.h
+++ b/mojo/common/common_custom_types_struct_traits.h
@@ -11,11 +11,21 @@
#include "base/version.h"
#include "mojo/common/file.mojom-shared.h"
#include "mojo/common/mojo_common_export.h"
+#include "mojo/common/platform_handle.h"
+#include "mojo/common/platform_handle.mojom-shared.h"
#include "mojo/common/string16.mojom-shared.h"
#include "mojo/common/time.mojom-shared.h"
#include "mojo/common/unguessable_token.mojom-shared.h"
#include "mojo/common/version.mojom-shared.h"
+#if defined(OS_POSIX)
+#include "mojo/common/common_custom_types_struct_traits_posix.h"
+#endif
+
+#if defined(OS_WIN)
+#include "mojo/common/common_custom_types_struct_traits_win.h"
+#endif
+
namespace mojo {
template <>
@@ -83,6 +93,23 @@ struct StructTraits<common::mojom::FileDataView, base::File> {
static bool Read(common::mojom::FileDataView data, base::File* file);
};
+template <typename DataView>
+struct StructTraits<DataView, common::InvalidTypemappedType> {
+ static bool IsNull(const common::InvalidTypemappedType& unused) {
+ return true;
+ }
+
+ static void SetToNull(common::InvalidTypemappedType* unused) {}
+
+ static mojo::ScopedHandle wrapped_handle(
+ const common::InvalidTypemappedType& unused) {
+ return mojo::ScopedHandle();
+ }
+ static bool Read(DataView data, common::InvalidTypemappedType* unused) {
+ return false;
+ }
+};
+
} // namespace mojo
#endif // MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_H_
« no previous file with comments | « mojo/common/BUILD.gn ('k') | mojo/common/common_custom_types_struct_traits_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698