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

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

Issue 2636073002: Create mojom and StructTraits for ui/display/types/display_mode.cc (Closed)
Patch Set: convert mojo type to ui::DisplayMode_Params instead. 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_proxy_struct_traits.h
diff --git a/ui/ozone/common/mojo/display_mode_proxy_struct_traits.h b/ui/ozone/common/mojo/display_mode_proxy_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..e0d2213eaea0b76d148931580e0547ac72d51c3c
--- /dev/null
+++ b/ui/ozone/common/mojo/display_mode_proxy_struct_traits.h
@@ -0,0 +1,43 @@
+// Copyright 2016 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_PROXY_STRUCT_TRAITS_H_
+#define UI_OZONE_COMMON_MOJO_DISPLAY_MODE_PROXY_STRUCT_TRAITS_H_
+
+#include "base/logging.h"
kylechar 2017/01/17 17:19:26 I don't think this is used.
thanhph1 2017/01/17 20:19:05 Done.
+#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
+
kylechar 2017/01/17 17:19:27 You have no #include that contains mojom::DisplayM
thanhph1 2017/01/17 20:19:05 Done.
+namespace mojo {
+
+template <>
+struct StructTraits<ui::mojom::DisplayModeProxyDataView,
+ ui::DisplayMode_Params> {
+ static const gfx::Size& size(const ui::DisplayMode_Params& d) {
kylechar 2017/01/17 17:19:26 I would call the parameter |mode| or |display_mode
thanhph1 2017/01/17 20:19:05 Done.
+ return d.size;
+ }
kylechar 2017/01/17 17:19:26 Whitespace between methods.
thanhph1 2017/01/17 20:19:05 Done.
+ 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::DisplayModeProxyDataView data,
+ ui::DisplayMode_Params* out) {
+ if (data.is_null())
kylechar 2017/01/17 17:19:27 You shouldn't need this check.
thanhph1 2017/01/17 20:19:05 Done.
+ return false;
+
+ 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_PROXY_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698