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

Unified Diff: cc/ipc/surface_info_struct_traits.h

Issue 2610723002: Unify SurfaceInfo (Closed)
Patch Set: Cleanup offscreen canvas Created 3 years, 12 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 | « cc/ipc/surface_info.typemap ('k') | cc/ipc/typemaps.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/ipc/surface_info_struct_traits.h
diff --git a/cc/ipc/surface_info_struct_traits.h b/cc/ipc/surface_info_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..b1484f829cb28eb9482ffc473b1f05699d9f553e
--- /dev/null
+++ b/cc/ipc/surface_info_struct_traits.h
@@ -0,0 +1,36 @@
+// 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 CC_IPC_SURFACE_INFO_STRUCT_TRAITS_H_
+#define CC_IPC_SURFACE_INFO_STRUCT_TRAITS_H_
+
+#include "cc/ipc/surface_info.mojom-shared.h"
+#include "cc/surfaces/surface_info.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<cc::mojom::SurfaceInfoDataView, cc::SurfaceInfo> {
+ static const cc::SurfaceId& surface_id(const cc::SurfaceInfo& surface_info) {
+ return surface_info.id();
+ }
+
+ static float device_scale_factor(const cc::SurfaceInfo& surface_info) {
+ return surface_info.device_scale_factor();
+ }
+
+ static const gfx::Size& size_in_pixels(const cc::SurfaceInfo& surface_info) {
+ return surface_info.size_in_pixels();
+ }
+
+ static bool Read(cc::mojom::SurfaceInfoDataView data, cc::SurfaceInfo* out) {
+ out->device_scale_factor_ = data.device_scale_factor();
+ return data.ReadSurfaceId(&out->id_) &&
+ data.ReadSizeInPixels(&out->size_in_pixels_);
+ }
+};
+
+} // namespace mojo
+
+#endif // CC_IPC_SURFACE_INFO_STRUCT_TRAITS_H_
« no previous file with comments | « cc/ipc/surface_info.typemap ('k') | cc/ipc/typemaps.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698