| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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_REFERENCE_STRUCT_TRAITS_H_ |
| 6 #define CC_IPC_SURFACE_REFERENCE_STRUCT_TRAITS_H_ |
| 7 |
| 8 #include "cc/ipc/surface_id_struct_traits.h" |
| 9 #include "cc/ipc/surface_reference.mojom-shared.h" |
| 10 #include "cc/surfaces/surface_id.h" |
| 11 #include "cc/surfaces/surface_reference.h" |
| 12 |
| 13 namespace mojo { |
| 14 |
| 15 template <> |
| 16 struct StructTraits<cc::mojom::SurfaceReferenceDataView, cc::SurfaceReference> { |
| 17 static const cc::SurfaceId& parent_id(const cc::SurfaceReference& ref) { |
| 18 return ref.parent_id(); |
| 19 } |
| 20 |
| 21 static const cc::SurfaceId& child_id(const cc::SurfaceReference& ref) { |
| 22 return ref.child_id(); |
| 23 } |
| 24 |
| 25 static bool Read(cc::mojom::SurfaceReferenceDataView data, |
| 26 cc::SurfaceReference* out) { |
| 27 if (!data.ReadChildId(&out->child_id_)) |
| 28 return false; |
| 29 |
| 30 if (!data.ReadParentId(&out->parent_id_)) |
| 31 return false; |
| 32 |
| 33 return true; |
| 34 } |
| 35 }; |
| 36 |
| 37 } // namespace mojo |
| 38 |
| 39 #endif // CC_IPC_SURFACE_REFERENCE_STRUCT_TRAITS_H_ |
| OLD | NEW |