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

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: undo deletion of includes in ui/ozone/common/BUILD.gn 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..223d51ed5ac2ccf428b0d84784ac05069fa02c54
--- /dev/null
+++ b/ui/ozone/common/mojo/display_mode_params_struct_traits.h
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_OZONE_COMMON_MOJO_DISPLAY_MODE_PARAMS_STRUCT_TRAITS_H_
+#define UI_OZONE_COMMON_MOJO_DISPLAY_MODE_PARAMS_STRUCT_TRAITS_H_
+
+#include "ui/gfx/geometry/size.h"
+#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
+#include "ui/ozone/common/mojo/display_mode_params.mojom.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<ui::mojom::DisplayModeParamsDataView,
+ ui::DisplayMode_Params> {
+ static const gfx::Size& size(const ui::DisplayMode_Params& display_mode) {
+ return display_mode.size;
+ }
+
+ static bool is_interlaced(const ui::DisplayMode_Params& display_mode) {
+ return display_mode.is_interlaced;
+ }
+
+ static float refresh_rate(const ui::DisplayMode_Params& display_mode) {
+ return display_mode.refresh_rate;
+ }
+
+ static bool Read(ui::mojom::DisplayModeParamsDataView data,
+ ui::DisplayMode_Params* out) {
+ if (!data.ReadSize(&out->size))
+ return false;
+
+ out->is_interlaced = data.is_interlaced();
+ out->refresh_rate = data.refresh_rate();
+
+ return true;
+ }
+};
+
+} // namespace mojo
+
+#endif // UI_OZONE_COMMON_MOJO_DISPLAY_MODE_PARAMS_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698