OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/events/ipc/latency_info_param_traits_macros.h" | 5 #include "ui/latency_info/ipc/latency_info_param_traits_macros.h" |
6 | 6 |
7 // Generate param traits write methods. | 7 // Generate param traits write methods. |
8 #include "ipc/param_traits_write_macros.h" | 8 #include "ipc/param_traits_write_macros.h" |
9 namespace IPC { | 9 namespace IPC { |
10 #undef UI_EVENTS_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_ | 10 #undef UI_LATENCY_INFO_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_ |
11 #include "ui/events/ipc/latency_info_param_traits_macros.h" | 11 #include "ui/latency_info/ipc/latency_info_param_traits_macros.h" |
12 } // namespace IPC | 12 } // namespace IPC |
13 | 13 |
14 // Generate param traits read methods. | 14 // Generate param traits read methods. |
15 #include "ipc/param_traits_read_macros.h" | 15 #include "ipc/param_traits_read_macros.h" |
16 namespace IPC { | 16 namespace IPC { |
17 #undef UI_EVENTS_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_ | 17 #undef UI_LATENCY_INFO_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_ |
18 #include "ui/events/ipc/latency_info_param_traits_macros.h" | 18 #include "ui/latency_info/ipc/latency_info_param_traits_macros.h" |
19 } // namespace IPC | 19 } // namespace IPC |
20 | 20 |
21 // Generate param traits log methods. | 21 // Generate param traits log methods. |
22 #include "ipc/param_traits_log_macros.h" | 22 #include "ipc/param_traits_log_macros.h" |
23 namespace IPC { | 23 namespace IPC { |
24 #undef UI_EVENTS_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_ | 24 #undef UI_LATENCY_INFO_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_ |
25 #include "ui/events/ipc/latency_info_param_traits_macros.h" | 25 #include "ui/latency_info/ipc/latency_info_param_traits_macros.h" |
26 } // namespace IPC | 26 } // namespace IPC |
27 | 27 |
28 // Implemetation for ParamTraits<ui::LatencyInfo>. | 28 // Implemetation for ParamTraits<ui::LatencyInfo>. |
29 #include "ui/events/ipc/latency_info_param_traits.h" | 29 #include "ui/latency_info/ipc/latency_info_param_traits.h" |
30 | 30 |
31 namespace IPC { | 31 namespace IPC { |
32 void ParamTraits<ui::LatencyInfo>::Write(base::Pickle* m, const param_type& p) { | 32 void ParamTraits<ui::LatencyInfo>::Write(base::Pickle* m, const param_type& p) { |
33 WriteParam(m, p.trace_name_); | 33 WriteParam(m, p.trace_name_); |
34 WriteParam(m, p.latency_components_); | 34 WriteParam(m, p.latency_components_); |
35 WriteParam(m, p.input_coordinates_size_); | 35 WriteParam(m, p.input_coordinates_size_); |
36 for (size_t i = 0; i < p.input_coordinates_size_; i++) { | 36 for (size_t i = 0; i < p.input_coordinates_size_; i++) { |
37 WriteParam(m, p.input_coordinates_[i]); | 37 WriteParam(m, p.input_coordinates_[i]); |
38 } | 38 } |
39 WriteParam(m, p.trace_id_); | 39 WriteParam(m, p.trace_id_); |
40 WriteParam(m, p.terminated_); | 40 WriteParam(m, p.terminated_); |
41 } | 41 } |
42 | 42 |
43 bool ParamTraits<ui::LatencyInfo>::Read(const base::Pickle* m, | 43 bool ParamTraits<ui::LatencyInfo>::Read(const base::Pickle* m, |
44 base::PickleIterator* iter, | 44 base::PickleIterator* iter, |
45 param_type* p) { | 45 param_type* p) { |
46 if (!ReadParam(m, iter, &p->trace_name_)) | 46 if (!ReadParam(m, iter, &p->trace_name_)) |
47 return false; | 47 return false; |
48 if (!ReadParam(m, iter, &p->latency_components_)) | 48 if (!ReadParam(m, iter, &p->latency_components_)) |
49 return false; | 49 return false; |
50 | 50 |
51 ui::LatencyInfo::InputCoordinate input_coordinates; | 51 ui::LatencyInfo::InputCoordinate input_coordinates; |
52 uint32_t input_coordinates_size; | 52 uint32_t input_coordinates_size; |
53 if (!ReadParam(m, iter, &input_coordinates_size)) | 53 if (!ReadParam(m, iter, &input_coordinates_size)) |
54 return false; | 54 return false; |
55 for (size_t i = 0; i < input_coordinates_size; i++) { | 55 for (size_t i = 0; i < input_coordinates_size; i++) { |
56 if (!ReadParam(m, iter, &input_coordinates)) | 56 if (!ReadParam(m, iter, &input_coordinates)) |
57 return false; | 57 return false; |
58 if (!p->AddInputCoordinate(input_coordinates)) | 58 if (!p->AddInputCoordinate(input_coordinates)) |
59 return false; | 59 return false; |
60 } | 60 } |
61 | 61 |
62 if (!ReadParam(m, iter, &p->trace_id_)) | 62 if (!ReadParam(m, iter, &p->trace_id_)) |
63 return false; | 63 return false; |
64 if (!ReadParam(m, iter, &p->terminated_)) | 64 if (!ReadParam(m, iter, &p->terminated_)) |
65 return false; | 65 return false; |
66 | 66 |
67 return true; | 67 return true; |
68 } | 68 } |
69 | 69 |
70 void ParamTraits<ui::LatencyInfo>::Log(const param_type& p, | 70 void ParamTraits<ui::LatencyInfo>::Log(const param_type& p, std::string* l) { |
71 std::string* l) { | |
72 LogParam(p.trace_name_, l); | 71 LogParam(p.trace_name_, l); |
73 l->append(" "); | 72 l->append(" "); |
74 LogParam(p.latency_components_, l); | 73 LogParam(p.latency_components_, l); |
75 l->append(" "); | 74 l->append(" "); |
76 LogParam(p.input_coordinates_size_, l); | 75 LogParam(p.input_coordinates_size_, l); |
77 l->append(" "); | 76 l->append(" "); |
78 for (size_t i = 0; i < p.input_coordinates_size_; i++) { | 77 for (size_t i = 0; i < p.input_coordinates_size_; i++) { |
79 LogParam(p.input_coordinates_[i], l); | 78 LogParam(p.input_coordinates_[i], l); |
80 l->append(" "); | 79 l->append(" "); |
81 } | 80 } |
82 LogParam(p.trace_id_, l); | 81 LogParam(p.trace_id_, l); |
83 l->append(" "); | 82 l->append(" "); |
84 LogParam(p.terminated_, l); | 83 LogParam(p.terminated_, l); |
85 } | 84 } |
86 | 85 |
87 } // namespace IPC | 86 } // namespace IPC |
OLD | NEW |