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

Unified Diff: mojo/common/common_custom_types_struct_traits.h

Issue 2324133003: [Media Router] Use TimeDelta in mojo interfaces (Closed)
Patch Set: Fix mojo test compile Created 4 years, 3 months 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.mojom ('k') | no next file » | 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 37fc5ca298a024430ca3d4e61c437d766a9749ea..5244cf7a2a6108280136a03f9a3bc385c49a5cb2 100644
--- a/mojo/common/common_custom_types_struct_traits.h
+++ b/mojo/common/common_custom_types_struct_traits.h
@@ -23,6 +23,19 @@ struct StructTraits<mojo::common::mojom::VersionDataView, base::Version> {
base::Version* out);
};
+template <>
+struct StructTraits<mojo::common::mojom::TimeDeltaDataView, base::TimeDelta> {
+ static int64_t microseconds(const base::TimeDelta& delta) {
+ return delta.InMicroseconds();
+ }
+
+ static bool Read(mojo::common::mojom::TimeDeltaDataView data,
+ base::TimeDelta* delta) {
+ *delta = base::TimeDelta::FromMicroseconds(data.microseconds());
+ return true;
+ }
+};
+
} // namespace mojo
#endif // MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_H_
« no previous file with comments | « mojo/common/common_custom_types.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698