cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ui / events / ipc / latency_info_param_traits.cc
blob1981bb2035241398b975f2f7e993e639ec340f34
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.
5 #include "ui/events/ipc/latency_info_param_traits_macros.h"
7 // Generate param traits write methods.
8 #include "ipc/param_traits_write_macros.h"
9 namespace IPC {
10 #undef UI_EVENTS_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_
11 #include "ui/events/ipc/latency_info_param_traits_macros.h"
12 } // namespace IPC
14 // Generate param traits read methods.
15 #include "ipc/param_traits_read_macros.h"
16 namespace IPC {
17 #undef UI_EVENTS_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_
18 #include "ui/events/ipc/latency_info_param_traits_macros.h"
19 } // namespace IPC
21 // Generate param traits log methods.
22 #include "ipc/param_traits_log_macros.h"
23 namespace IPC {
24 #undef UI_EVENTS_IPC_LATENCY_INFO_PARAM_TRAITS_MACROS_H_
25 #include "ui/events/ipc/latency_info_param_traits_macros.h"
26 } // namespace IPC
28 // Implemetation for ParamTraits<ui::LatencyInfo>.
29 #include "ui/events/ipc/latency_info_param_traits.h"
31 namespace IPC {
32 void ParamTraits<ui::LatencyInfo>::Write(Message* m,
33 const param_type& p) {
34 WriteParam(m, p.trace_name_);
35 WriteParam(m, p.latency_components_);
36 WriteParam(m, p.input_coordinates_size_);
37 for (size_t i = 0; i < p.input_coordinates_size_; i++) {
38 WriteParam(m, p.input_coordinates_[i]);
40 WriteParam(m, p.coalesced_events_size_);
41 for (size_t i = 0; i < p.coalesced_events_size_; i++) {
42 WriteParam(m, p.timestamps_of_coalesced_events_[i]);
44 WriteParam(m, p.trace_id_);
45 WriteParam(m, p.terminated_);
48 bool ParamTraits<ui::LatencyInfo>::Read(const Message* m,
49 base::PickleIterator* iter,
50 param_type* p) {
51 if (!ReadParam(m, iter, &p->trace_name_))
52 return false;
53 if (!ReadParam(m, iter, &p->latency_components_))
54 return false;
56 ui::LatencyInfo::InputCoordinate input_coordinates;
57 uint32 input_coordinates_size;
58 if (!ReadParam(m, iter, &input_coordinates_size))
59 return false;
60 for (size_t i = 0; i < input_coordinates_size; i++) {
61 if (!ReadParam(m, iter, &input_coordinates))
62 return false;
63 if (!p->AddInputCoordinate(input_coordinates))
64 return false;
67 double timestamp;
68 uint32 coalesced_events_size;
69 if (!ReadParam(m, iter, &coalesced_events_size))
70 return false;
71 for (size_t i = 0; i < coalesced_events_size; i++) {
72 if (!ReadParam(m, iter, &timestamp))
73 return false;
74 if (!p->AddCoalescedEventTimestamp(timestamp))
75 return false;
78 if (!ReadParam(m, iter, &p->trace_id_))
79 return false;
80 if (!ReadParam(m, iter, &p->terminated_))
81 return false;
83 return true;
86 void ParamTraits<ui::LatencyInfo>::Log(const param_type& p,
87 std::string* l) {
88 LogParam(p.trace_name_, l);
89 l->append(" ");
90 LogParam(p.latency_components_, l);
91 l->append(" ");
92 LogParam(p.input_coordinates_size_, l);
93 l->append(" ");
94 for (size_t i = 0; i < p.input_coordinates_size_; i++) {
95 LogParam(p.input_coordinates_[i], l);
96 l->append(" ");
98 LogParam(p.coalesced_events_size_, l);
99 l->append(" ");
100 for (size_t i = 0; i < p.coalesced_events_size_; i++) {
101 LogParam(p.timestamps_of_coalesced_events_[i], l);
102 l->append(" ");
104 LogParam(p.trace_id_, l);
105 l->append(" ");
106 LogParam(p.terminated_, l);
109 } // namespace IPC