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_BEGIN_FRAME_ARGS_STRUCT_TRAITS_H_ | 5 #ifndef CC_IPC_BEGIN_FRAME_ARGS_STRUCT_TRAITS_H_ |
6 #define CC_IPC_BEGIN_FRAME_ARGS_STRUCT_TRAITS_H_ | 6 #define CC_IPC_BEGIN_FRAME_ARGS_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "cc/ipc/begin_frame_args.mojom-shared.h" | 8 #include "cc/ipc/begin_frame_args.mojom-shared.h" |
9 #include "cc/output/begin_frame_args.h" | 9 #include "cc/output/begin_frame_args.h" |
| 10 #include "ipc/ipc_message_utils.h" |
| 11 #include "mojo/common/common_custom_types_struct_traits.h" |
10 | 12 |
11 namespace mojo { | 13 namespace mojo { |
12 | 14 |
13 template <> | 15 template <> |
14 struct StructTraits<cc::mojom::BeginFrameArgsDataView, cc::BeginFrameArgs> { | 16 struct StructTraits<cc::mojom::BeginFrameArgsDataView, cc::BeginFrameArgs> { |
15 static base::TimeTicks frame_time(const cc::BeginFrameArgs& args) { | 17 static base::TimeTicks frame_time(const cc::BeginFrameArgs& args) { |
16 return args.frame_time; | 18 return args.frame_time; |
17 } | 19 } |
18 | 20 |
19 static base::TimeTicks deadline(const cc::BeginFrameArgs& args) { | 21 static base::TimeTicks deadline(const cc::BeginFrameArgs& args) { |
(...skipping 29 matching lines...) Expand all Loading... |
49 } | 51 } |
50 out->source_id = data.source_id(); | 52 out->source_id = data.source_id(); |
51 out->sequence_number = data.sequence_number(); | 53 out->sequence_number = data.sequence_number(); |
52 out->type = | 54 out->type = |
53 static_cast<cc::BeginFrameArgs::BeginFrameArgsType>(data.type()); | 55 static_cast<cc::BeginFrameArgs::BeginFrameArgsType>(data.type()); |
54 out->on_critical_path = data.on_critical_path(); | 56 out->on_critical_path = data.on_critical_path(); |
55 return true; | 57 return true; |
56 } | 58 } |
57 }; | 59 }; |
58 | 60 |
| 61 template <> |
| 62 struct StructTraits<cc::mojom::BeginFrameAckDataView, cc::BeginFrameAck> { |
| 63 static uint64_t sequence_number(const cc::BeginFrameAck& ack) { |
| 64 return ack.sequence_number; |
| 65 } |
| 66 |
| 67 static uint64_t latest_confirmed_sequence_number( |
| 68 const cc::BeginFrameAck& ack) { |
| 69 return ack.latest_confirmed_sequence_number; |
| 70 } |
| 71 |
| 72 static uint32_t source_id(const cc::BeginFrameAck& ack) { |
| 73 return ack.source_id; |
| 74 } |
| 75 |
| 76 static bool Read(cc::mojom::BeginFrameAckDataView data, |
| 77 cc::BeginFrameAck* out) { |
| 78 out->source_id = data.source_id(); |
| 79 out->sequence_number = data.sequence_number(); |
| 80 out->latest_confirmed_sequence_number = |
| 81 data.latest_confirmed_sequence_number(); |
| 82 return true; |
| 83 } |
| 84 }; |
| 85 |
59 } // namespace mojo | 86 } // namespace mojo |
60 | 87 |
61 #endif // CC_IPC_BEGIN_FRAME_ARGS_STRUCT_TRAITS_H_ | 88 #endif // CC_IPC_BEGIN_FRAME_ARGS_STRUCT_TRAITS_H_ |
OLD | NEW |