Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: ui/events/mojo/latency_info_struct_traits.h

Issue 2048673002: Revert of Replace ui::LatencyInfo::InputCoordinate with gfx::PointF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/mojo/latency_info.typemap ('k') | ui/events/mojo/latency_info_struct_traits.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 10
12 namespace mojo { 11 namespace mojo {
13 12
13 template <>
14 struct StructTraits<ui::mojom::InputCoordinate,
15 ui::LatencyInfo::InputCoordinate> {
16 static float x(const ui::LatencyInfo::InputCoordinate& input) {
17 return input.x;
18 }
19 static float y(const ui::LatencyInfo::InputCoordinate& input) {
20 return input.y;
21 }
22 static bool Read(ui::mojom::InputCoordinateDataView data,
23 ui::LatencyInfo::InputCoordinate* out) {
24 out->x = data.x();
25 out->y = data.y();
26 return true;
27 }
28 };
29
14 // A buffer used to read bytes directly from LatencyInfoDataView into 30 // A buffer used to read bytes directly from LatencyInfoDataView into
15 // ui::LatencyInfo's input_coordinates_. 31 // ui::LatencyInfo's input_coordinates_.
16 struct InputCoordinateArray { 32 struct InputCoordinateArray {
17 size_t size; 33 size_t size;
18 gfx::PointF* data; 34 ui::LatencyInfo::InputCoordinate* data;
19 }; 35 };
20 36
21 // TODO(fsamuel): We should add a common ArrayTraits<CArray<T>> utility struct. 37 // TODO(fsamuel): We should add a common ArrayTraits<CArray<T>> utility struct.
22 template <> 38 template <>
23 struct ArrayTraits<InputCoordinateArray> { 39 struct ArrayTraits<InputCoordinateArray> {
24 using Element = gfx::PointF; 40 using Element = ui::LatencyInfo::InputCoordinate;
25 static size_t GetSize(const InputCoordinateArray& b); 41 static size_t GetSize(const InputCoordinateArray& b);
26 static Element* GetData(InputCoordinateArray& b); 42 static Element* GetData(InputCoordinateArray& b);
27 static const Element* GetData(const InputCoordinateArray& b); 43 static const Element* GetData(const InputCoordinateArray& b);
28 static Element& GetAt(InputCoordinateArray& b, size_t i); 44 static Element& GetAt(InputCoordinateArray& b, size_t i);
29 static const Element& GetAt(const InputCoordinateArray& b, size_t i); 45 static const Element& GetAt(const InputCoordinateArray& b, size_t i);
30 static bool Resize(InputCoordinateArray& b, size_t size); 46 static bool Resize(InputCoordinateArray& b, size_t size);
31 }; 47 };
32 48
33 template <> 49 template <>
34 struct StructTraits<ui::mojom::LatencyComponent, 50 struct StructTraits<ui::mojom::LatencyComponent,
(...skipping 30 matching lines...) Expand all
65 static InputCoordinateArray input_coordinates(const ui::LatencyInfo& info); 81 static InputCoordinateArray input_coordinates(const ui::LatencyInfo& info);
66 static int64_t trace_id(const ui::LatencyInfo& info); 82 static int64_t trace_id(const ui::LatencyInfo& info);
67 static bool coalesced(const ui::LatencyInfo& info); 83 static bool coalesced(const ui::LatencyInfo& info);
68 static bool terminated(const ui::LatencyInfo& info); 84 static bool terminated(const ui::LatencyInfo& info);
69 static bool Read(ui::mojom::LatencyInfoDataView data, ui::LatencyInfo* out); 85 static bool Read(ui::mojom::LatencyInfoDataView data, ui::LatencyInfo* out);
70 }; 86 };
71 87
72 } // namespace mojo 88 } // namespace mojo
73 89
74 #endif // UI_EVENTS_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_ 90 #endif // UI_EVENTS_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « ui/events/mojo/latency_info.typemap ('k') | ui/events/mojo/latency_info_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698