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_BEGIN_FRAME_ARGS_STRUCT_TRAITS_H_ |
| 6 #define CC_IPC_BEGIN_FRAME_ARGS_STRUCT_TRAITS_H_ |
| 7 |
| 8 #include "cc/ipc/begin_frame_args.mojom.h" |
| 9 #include "cc/output/begin_frame_args.h" |
| 10 |
| 11 namespace mojo { |
| 12 |
| 13 template <> |
| 14 struct StructTraits<cc::mojom::BeginFrameArgs, cc::BeginFrameArgs> { |
| 15 static base::TimeTicks frame_time(const cc::BeginFrameArgs& args) { |
| 16 return args.frame_time; |
| 17 } |
| 18 |
| 19 static base::TimeTicks deadline(const cc::BeginFrameArgs& args) { |
| 20 return args.deadline; |
| 21 } |
| 22 |
| 23 static base::TimeDelta interval(const cc::BeginFrameArgs& args) { |
| 24 return args.interval; |
| 25 } |
| 26 |
| 27 static cc::mojom::BeginFrameArgsType type(const cc::BeginFrameArgs& args) { |
| 28 return static_cast<cc::mojom::BeginFrameArgsType>(args.type); |
| 29 } |
| 30 |
| 31 static bool on_critical_path(const cc::BeginFrameArgs& args) { |
| 32 return args.on_critical_path; |
| 33 } |
| 34 |
| 35 static bool Read(cc::mojom::BeginFrameArgsDataView data, |
| 36 cc::BeginFrameArgs* out) { |
| 37 if (!data.ReadFrameTime(&out->frame_time) || |
| 38 !data.ReadDeadline(&out->deadline) || |
| 39 !data.ReadInterval(&out->interval)) { |
| 40 return false; |
| 41 } |
| 42 out->type = |
| 43 static_cast<cc::BeginFrameArgs::BeginFrameArgsType>(data.type()); |
| 44 out->on_critical_path = data.on_critical_path(); |
| 45 return true; |
| 46 } |
| 47 }; |
| 48 |
| 49 } // namespace mojo |
| 50 |
| 51 #endif // CC_IPC_BEGIN_FRAME_ARGS_STRUCT_TRAITS_H_ |
OLD | NEW |