OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_IPC_SURFACE_INFO_STRUCT_TRAITS_H_ |
| 6 #define CC_IPC_SURFACE_INFO_STRUCT_TRAITS_H_ |
| 7 |
| 8 #include "cc/ipc/surface_info.mojom-shared.h" |
| 9 #include "cc/surfaces/surface_info.h" |
| 10 |
| 11 namespace mojo { |
| 12 |
| 13 template <> |
| 14 struct StructTraits<cc::mojom::SurfaceInfoDataView, cc::SurfaceInfo> { |
| 15 static const cc::SurfaceId& surface_id(const cc::SurfaceInfo& surface_info) { |
| 16 return surface_info.id(); |
| 17 } |
| 18 |
| 19 static float device_scale_factor(const cc::SurfaceInfo& surface_info) { |
| 20 return surface_info.device_scale_factor(); |
| 21 } |
| 22 |
| 23 static const gfx::Size& size_in_pixels(const cc::SurfaceInfo& surface_info) { |
| 24 return surface_info.size_in_pixels(); |
| 25 } |
| 26 |
| 27 static bool Read(cc::mojom::SurfaceInfoDataView data, cc::SurfaceInfo* out) { |
| 28 out->device_scale_factor_ = data.device_scale_factor(); |
| 29 return data.ReadSurfaceId(&out->id_) && |
| 30 data.ReadSizeInPixels(&out->size_in_pixels_); |
| 31 } |
| 32 }; |
| 33 |
| 34 } // namespace mojo |
| 35 |
| 36 #endif // CC_IPC_SURFACE_INFO_STRUCT_TRAITS_H_ |
OLD | NEW |