Update V8 to version 4.6.52.
[chromium-blink-merge.git] / ui / events / ipc / latency_info_param_traits.cc
blob0fcce3521885049192d5ad1a5f501926b315a917
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.trace_id_);
41 WriteParam(m, p.terminated_);
44 bool ParamTraits<ui::LatencyInfo>::Read(const Message* m,
45 base::PickleIterator* iter,
46 param_type* p) {
47 if (!ReadParam(m, iter, &p->trace_name_))
48 return false;
49 if (!ReadParam(m, iter, &p->latency_components_))
50 return false;
52 ui::LatencyInfo::InputCoordinate input_coordinates;
53 uint32 input_coordinates_size;
54 if (!ReadParam(m, iter, &input_coordinates_size))
55 return false;
56 for (size_t i = 0; i < input_coordinates_size; i++) {
57 if (!ReadParam(m, iter, &input_coordinates))
58 return false;
59 p->AddInputCoordinate(input_coordinates);
61 if (!ReadParam(m, iter, &p->trace_id_))
62 return false;
63 if (!ReadParam(m, iter, &p->terminated_))
64 return false;
66 return true;
69 void ParamTraits<ui::LatencyInfo>::Log(const param_type& p,
70 std::string* l) {
71 LogParam(p.trace_name_, l);
72 l->append(" ");
73 LogParam(p.latency_components_, l);
74 l->append(" ");
75 LogParam(p.input_coordinates_size_, l);
76 l->append(" ");
77 for (size_t i = 0; i < p.input_coordinates_size_; i++) {
78 LogParam(p.input_coordinates_[i], l);
79 l->append(" ");
81 LogParam(p.trace_id_, l);
82 l->append(" ");
83 LogParam(p.terminated_, l);
86 } // namespace IPC