| 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 UI_EVENTS_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_ | 5 #ifndef UI_EVENTS_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_ |
| 6 #define UI_EVENTS_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_ | 6 #define UI_EVENTS_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_ |
| 7 | 7 |
| 8 #include "ui/events/latency_info.h" | 8 #include "ui/events/latency_info.h" |
| 9 #include "ui/events/mojo/latency_info.mojom.h" | 9 #include "ui/events/mojo/latency_info.mojom.h" |
| 10 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" | 10 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" |
| 11 | 11 |
| 12 namespace mojo { | 12 namespace mojo { |
| 13 | 13 |
| 14 using InputCoordinateArray = CArray<gfx::PointF>; | 14 using InputCoordinateArray = CArray<gfx::PointF>; |
| 15 | 15 |
| 16 template <> | 16 template <> |
| 17 struct ArrayTraits<ui::LatencyInfo::LatencyMap> { | 17 struct ArrayTraits<ui::LatencyInfo::LatencyMap> { |
| 18 using Element = ui::LatencyInfo::LatencyMap::value_type; | 18 using Element = ui::LatencyInfo::LatencyMap::value_type; |
| 19 using Iterator = ui::LatencyInfo::LatencyMap::iterator; | 19 using Iterator = ui::LatencyInfo::LatencyMap::iterator; |
| 20 using ConstIterator = ui::LatencyInfo::LatencyMap::const_iterator; | 20 using ConstIterator = ui::LatencyInfo::LatencyMap::const_iterator; |
| 21 | 21 |
| 22 static ConstIterator GetBegin(const ui::LatencyInfo::LatencyMap& input) { | 22 static ConstIterator GetBegin(const ui::LatencyInfo::LatencyMap& input) { |
| 23 return input.begin(); | 23 return input.begin(); |
| 24 } | 24 } |
| 25 static Iterator GetBegin(ui::LatencyInfo::LatencyMap& input) { | 25 static Iterator GetBegin(ui::LatencyInfo::LatencyMap& input) { |
| 26 return input.begin(); | 26 return input.begin(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 static void AdvanceIterator(ConstIterator& iterator) { iterator++; } | 29 static void AdvanceIterator(const ui::LatencyInfo::LatencyMap& input, |
| 30 static void AdvanceIterator(Iterator& iterator) { iterator++; } | 30 ConstIterator& iterator) { |
| 31 iterator++; |
| 32 } |
| 33 static void AdvanceIterator(ui::LatencyInfo::LatencyMap& input, |
| 34 Iterator& iterator) { |
| 35 iterator++; |
| 36 } |
| 31 | 37 |
| 32 static const Element& GetValue(ConstIterator& iterator) { return *iterator; } | 38 static const Element& GetValue(const ui::LatencyInfo::LatencyMap& input, |
| 33 static Element& GetValue(Iterator& iterator) { return *iterator; } | 39 ConstIterator& iterator) { |
| 40 return *iterator; |
| 41 } |
| 42 static Element& GetValue(ui::LatencyInfo::LatencyMap& input, |
| 43 Iterator& iterator) { |
| 44 return *iterator; |
| 45 } |
| 34 | 46 |
| 35 static size_t GetSize(const ui::LatencyInfo::LatencyMap& input) { | 47 static size_t GetSize(const ui::LatencyInfo::LatencyMap& input) { |
| 36 return input.size(); | 48 return input.size(); |
| 37 } | 49 } |
| 38 }; | 50 }; |
| 39 | 51 |
| 40 template <> | 52 template <> |
| 41 struct StructTraits<ui::mojom::LatencyComponent, | 53 struct StructTraits<ui::mojom::LatencyComponent, |
| 42 ui::LatencyInfo::LatencyComponent> { | 54 ui::LatencyInfo::LatencyComponent> { |
| 43 static int64_t sequence_number( | 55 static int64_t sequence_number( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 static InputCoordinateArray input_coordinates(const ui::LatencyInfo& info); | 97 static InputCoordinateArray input_coordinates(const ui::LatencyInfo& info); |
| 86 static int64_t trace_id(const ui::LatencyInfo& info); | 98 static int64_t trace_id(const ui::LatencyInfo& info); |
| 87 static bool coalesced(const ui::LatencyInfo& info); | 99 static bool coalesced(const ui::LatencyInfo& info); |
| 88 static bool terminated(const ui::LatencyInfo& info); | 100 static bool terminated(const ui::LatencyInfo& info); |
| 89 static bool Read(ui::mojom::LatencyInfoDataView data, ui::LatencyInfo* out); | 101 static bool Read(ui::mojom::LatencyInfoDataView data, ui::LatencyInfo* out); |
| 90 }; | 102 }; |
| 91 | 103 |
| 92 } // namespace mojo | 104 } // namespace mojo |
| 93 | 105 |
| 94 #endif // UI_EVENTS_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_ | 106 #endif // UI_EVENTS_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_ |
| OLD | NEW |