OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 #include "ui/events/ipc/latency_info_param_traits_macros.h" | |
6 | |
7 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" | |
8 | |
9 // Generate param traits size methods. | |
10 #include "ipc/param_traits_size_macros.h" | |
11 namespace IPC { | |
12 #undef UI_EVENTS_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_ | |
13 #include "ui/events/ipc/latency_info_param_traits_macros.h" | |
14 } | |
15 | |
16 // Generate param traits write methods. | |
17 #include "ipc/param_traits_write_macros.h" | |
18 namespace IPC { | |
19 #undef UI_EVENTS_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_ | |
20 #include "ui/events/ipc/latency_info_param_traits_macros.h" | |
21 } // namespace IPC | |
22 | |
23 // Generate param traits read methods. | |
24 #include "ipc/param_traits_read_macros.h" | |
25 namespace IPC { | |
26 #undef UI_EVENTS_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_ | |
27 #include "ui/events/ipc/latency_info_param_traits_macros.h" | |
28 } // namespace IPC | |
29 | |
30 // Generate param traits log methods. | |
31 #include "ipc/param_traits_log_macros.h" | |
32 namespace IPC { | |
33 #undef UI_EVENTS_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_ | |
34 #include "ui/events/ipc/latency_info_param_traits_macros.h" | |
35 } // namespace IPC | |
36 | |
37 // Implemetation for ParamTraits<ui::LatencyInfo>. | |
38 #include "ui/events/ipc/latency_info_param_traits.h" | |
39 | |
40 namespace IPC { | |
41 | |
42 void ParamTraits<ui::LatencyInfo>::GetSize(base::PickleSizer* s, | |
43 const param_type& p) { | |
44 GetParamSize(s, p.trace_name_); | |
45 GetParamSize(s, p.latency_components_); | |
46 GetParamSize(s, p.input_coordinates_size_); | |
47 for (size_t i = 0; i < p.input_coordinates_size_; i++) { | |
48 GetParamSize(s, p.input_coordinates_[i]); | |
49 } | |
50 GetParamSize(s, p.trace_id_); | |
51 GetParamSize(s, p.terminated_); | |
52 GetParamSize(s, p.source_event_type_); | |
53 } | |
54 | |
55 void ParamTraits<ui::LatencyInfo>::Write(base::Pickle* m, const param_type& p) { | |
56 WriteParam(m, p.trace_name_); | |
57 WriteParam(m, p.latency_components_); | |
58 WriteParam(m, p.input_coordinates_size_); | |
59 for (size_t i = 0; i < p.input_coordinates_size_; i++) { | |
60 WriteParam(m, p.input_coordinates_[i]); | |
61 } | |
62 WriteParam(m, p.trace_id_); | |
63 WriteParam(m, p.terminated_); | |
64 WriteParam(m, p.source_event_type_); | |
65 } | |
66 | |
67 bool ParamTraits<ui::LatencyInfo>::Read(const base::Pickle* m, | |
68 base::PickleIterator* iter, | |
69 param_type* p) { | |
70 if (!ReadParam(m, iter, &p->trace_name_)) | |
71 return false; | |
72 if (!ReadParam(m, iter, &p->latency_components_)) | |
73 return false; | |
74 | |
75 gfx::PointF input_coordinates; | |
76 uint32_t input_coordinates_size; | |
77 if (!ReadParam(m, iter, &input_coordinates_size)) | |
78 return false; | |
79 for (size_t i = 0; i < input_coordinates_size; i++) { | |
80 if (!ReadParam(m, iter, &input_coordinates)) | |
81 return false; | |
82 if (!p->AddInputCoordinate(input_coordinates)) | |
83 return false; | |
84 } | |
85 | |
86 if (!ReadParam(m, iter, &p->trace_id_)) | |
87 return false; | |
88 if (!ReadParam(m, iter, &p->terminated_)) | |
89 return false; | |
90 if (!ReadParam(m, iter, &p->source_event_type_)) | |
91 return false; | |
92 | |
93 return true; | |
94 } | |
95 | |
96 void ParamTraits<ui::LatencyInfo>::Log(const param_type& p, | |
97 std::string* l) { | |
98 LogParam(p.trace_name_, l); | |
99 l->append(" "); | |
100 LogParam(p.latency_components_, l); | |
101 l->append(" "); | |
102 LogParam(p.input_coordinates_size_, l); | |
103 l->append(" "); | |
104 for (size_t i = 0; i < p.input_coordinates_size_; i++) { | |
105 LogParam(p.input_coordinates_[i], l); | |
106 l->append(" "); | |
107 } | |
108 LogParam(p.trace_id_, l); | |
109 l->append(" "); | |
110 LogParam(p.terminated_, l); | |
111 l->append(" "); | |
112 LogParam(p.source_event_type_, l); | |
113 } | |
114 | |
115 } // namespace IPC | |
OLD | NEW |