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

Unified Diff: ui/ozone/common/mojo/display_mode_params_struct_traits.h

Issue 2636073002: Create mojom and StructTraits for ui/display/types/display_mode.cc (Closed)
Patch Set: Created 3 years, 11 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
Index: ui/ozone/common/mojo/display_mode_params_struct_traits.h
diff --git a/ui/ozone/common/mojo/display_mode_params_struct_traits.h b/ui/ozone/common/mojo/display_mode_params_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..6548cc93e480293edc8521b2dc2984a2201dfeaa
--- /dev/null
+++ b/ui/ozone/common/mojo/display_mode_params_struct_traits.h
@@ -0,0 +1,31 @@
+#ifndef UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_
+#define UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_
+
+#include "ui/ozone/common/mojo/display_mode_params.mojom.h"
+#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<ui::mojom::DisplayModeParamsDataView, ui::DisplayMode_Params> {
+ static const gfx::Size& size(const ui::DisplayMode_Params& d) { return d.size; }
+ static bool is_interlaced(const ui::DisplayMode_Params& d) { return d.is_interlaced; }
+ static float refresh_rate(const ui::DisplayMode_Params& d) {
+ return d.refresh_rate;
+ }
+
+ static bool Read(ui::mojom::DisplayModeParamsDataView data, ui::DisplayMode_Params* out) {
+
kylechar 2017/01/16 23:08:24 You're not setting is_interlaced or refresh_rate o
thanhph1 2017/01/17 16:47:59 Done, thanks!
+ if (data.is_null())
+ return false;
+
+ if (!data.ReadSize(&out->size))
+ return false;
+ return true;
+ }
+
+};
+
+}
+
+#endif // UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698