OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_ | 5 #ifndef CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_ |
6 #define CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_ | 6 #define CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_ |
7 | 7 |
| 8 #include "cc/ipc/frame_sink_id_struct_traits.h" |
8 #include "cc/ipc/surface_id.mojom-shared.h" | 9 #include "cc/ipc/surface_id.mojom-shared.h" |
| 10 #include "cc/surfaces/frame_sink_id.h" |
9 #include "cc/surfaces/surface_id.h" | 11 #include "cc/surfaces/surface_id.h" |
10 | 12 |
11 namespace mojo { | 13 namespace mojo { |
12 | 14 |
13 template <> | 15 template <> |
14 struct StructTraits<cc::mojom::SurfaceIdDataView, cc::SurfaceId> { | 16 struct StructTraits<cc::mojom::SurfaceIdDataView, cc::SurfaceId> { |
15 static uint32_t client_id(const cc::SurfaceId& id) { return id.client_id(); } | 17 static const cc::FrameSinkId& frame_sink_id(const cc::SurfaceId& id) { |
| 18 return id.frame_sink_id(); |
| 19 } |
16 | 20 |
17 static uint32_t local_id(const cc::SurfaceId& id) { return id.local_id(); } | 21 static uint32_t local_id(const cc::SurfaceId& id) { return id.local_id(); } |
18 | 22 |
19 static uint64_t nonce(const cc::SurfaceId& id) { return id.nonce(); } | 23 static uint64_t nonce(const cc::SurfaceId& id) { return id.nonce(); } |
20 | 24 |
21 static bool Read(cc::mojom::SurfaceIdDataView data, cc::SurfaceId* out) { | 25 static bool Read(cc::mojom::SurfaceIdDataView data, cc::SurfaceId* out) { |
22 *out = cc::SurfaceId(data.client_id(), data.local_id(), data.nonce()); | 26 cc::FrameSinkId frame_sink_id; |
| 27 if (!data.ReadFrameSinkId(&frame_sink_id)) |
| 28 return false; |
| 29 *out = cc::SurfaceId(frame_sink_id, data.local_id(), data.nonce()); |
23 return true; | 30 return true; |
24 } | 31 } |
25 }; | 32 }; |
26 | 33 |
27 } // namespace mojo | 34 } // namespace mojo |
28 | 35 |
29 #endif // CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_ | 36 #endif // CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_ |
OLD | NEW |