| 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/gfx/ipc/geometry/gfx_param_traits.h" | 5 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" |
| 6 #include "ui/latency/ipc/latency_info_param_traits_macros.h" | 6 #include "ui/latency/ipc/latency_info_param_traits_macros.h" |
| 7 | 7 |
| 8 // Generate param traits size methods. | 8 // Generate param traits size methods. |
| 9 #include "ipc/param_traits_size_macros.h" | 9 #include "ipc/param_traits_size_macros.h" |
| 10 namespace IPC { | 10 namespace IPC { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Implemetation for ParamTraits<ui::LatencyInfo>. | 36 // Implemetation for ParamTraits<ui::LatencyInfo>. |
| 37 #include "ui/latency/ipc/latency_info_param_traits.h" | 37 #include "ui/latency/ipc/latency_info_param_traits.h" |
| 38 | 38 |
| 39 namespace IPC { | 39 namespace IPC { |
| 40 | 40 |
| 41 void ParamTraits<ui::LatencyInfo>::GetSize(base::PickleSizer* s, | 41 void ParamTraits<ui::LatencyInfo>::GetSize(base::PickleSizer* s, |
| 42 const param_type& p) { | 42 const param_type& p) { |
| 43 GetParamSize(s, p.trace_name_); | 43 GetParamSize(s, p.trace_name_); |
| 44 GetParamSize(s, p.latency_components_); | 44 GetParamSize(s, p.latency_components_); |
| 45 GetParamSize(s, p.input_coordinates_size_); | |
| 46 for (size_t i = 0; i < p.input_coordinates_size_; i++) { | |
| 47 GetParamSize(s, p.input_coordinates_[i]); | |
| 48 } | |
| 49 GetParamSize(s, p.trace_id_); | 45 GetParamSize(s, p.trace_id_); |
| 50 GetParamSize(s, p.terminated_); | 46 GetParamSize(s, p.terminated_); |
| 51 GetParamSize(s, p.source_event_type_); | 47 GetParamSize(s, p.source_event_type_); |
| 52 } | 48 } |
| 53 | 49 |
| 54 void ParamTraits<ui::LatencyInfo>::Write(base::Pickle* m, const param_type& p) { | 50 void ParamTraits<ui::LatencyInfo>::Write(base::Pickle* m, const param_type& p) { |
| 55 WriteParam(m, p.trace_name_); | 51 WriteParam(m, p.trace_name_); |
| 56 WriteParam(m, p.latency_components_); | 52 WriteParam(m, p.latency_components_); |
| 57 WriteParam(m, p.input_coordinates_size_); | |
| 58 for (size_t i = 0; i < p.input_coordinates_size_; i++) { | |
| 59 WriteParam(m, p.input_coordinates_[i]); | |
| 60 } | |
| 61 WriteParam(m, p.trace_id_); | 53 WriteParam(m, p.trace_id_); |
| 62 WriteParam(m, p.terminated_); | 54 WriteParam(m, p.terminated_); |
| 63 WriteParam(m, p.source_event_type_); | 55 WriteParam(m, p.source_event_type_); |
| 64 } | 56 } |
| 65 | 57 |
| 66 bool ParamTraits<ui::LatencyInfo>::Read(const base::Pickle* m, | 58 bool ParamTraits<ui::LatencyInfo>::Read(const base::Pickle* m, |
| 67 base::PickleIterator* iter, | 59 base::PickleIterator* iter, |
| 68 param_type* p) { | 60 param_type* p) { |
| 69 if (!ReadParam(m, iter, &p->trace_name_)) | 61 if (!ReadParam(m, iter, &p->trace_name_)) |
| 70 return false; | 62 return false; |
| 71 if (!ReadParam(m, iter, &p->latency_components_)) | 63 if (!ReadParam(m, iter, &p->latency_components_)) |
| 72 return false; | 64 return false; |
| 73 | 65 |
| 74 gfx::PointF input_coordinates; | |
| 75 uint32_t input_coordinates_size; | |
| 76 if (!ReadParam(m, iter, &input_coordinates_size)) | |
| 77 return false; | |
| 78 for (size_t i = 0; i < input_coordinates_size; i++) { | |
| 79 if (!ReadParam(m, iter, &input_coordinates)) | |
| 80 return false; | |
| 81 if (!p->AddInputCoordinate(input_coordinates)) | |
| 82 return false; | |
| 83 } | |
| 84 | |
| 85 if (!ReadParam(m, iter, &p->trace_id_)) | 66 if (!ReadParam(m, iter, &p->trace_id_)) |
| 86 return false; | 67 return false; |
| 87 if (!ReadParam(m, iter, &p->terminated_)) | 68 if (!ReadParam(m, iter, &p->terminated_)) |
| 88 return false; | 69 return false; |
| 89 if (!ReadParam(m, iter, &p->source_event_type_)) | 70 if (!ReadParam(m, iter, &p->source_event_type_)) |
| 90 return false; | 71 return false; |
| 91 | 72 |
| 92 return true; | 73 return true; |
| 93 } | 74 } |
| 94 | 75 |
| 95 void ParamTraits<ui::LatencyInfo>::Log(const param_type& p, std::string* l) { | 76 void ParamTraits<ui::LatencyInfo>::Log(const param_type& p, std::string* l) { |
| 96 LogParam(p.trace_name_, l); | 77 LogParam(p.trace_name_, l); |
| 97 l->append(" "); | 78 l->append(" "); |
| 98 LogParam(p.latency_components_, l); | 79 LogParam(p.latency_components_, l); |
| 99 l->append(" "); | 80 l->append(" "); |
| 100 LogParam(p.input_coordinates_size_, l); | |
| 101 l->append(" "); | |
| 102 for (size_t i = 0; i < p.input_coordinates_size_; i++) { | |
| 103 LogParam(p.input_coordinates_[i], l); | |
| 104 l->append(" "); | |
| 105 } | |
| 106 LogParam(p.trace_id_, l); | 81 LogParam(p.trace_id_, l); |
| 107 l->append(" "); | 82 l->append(" "); |
| 108 LogParam(p.terminated_, l); | 83 LogParam(p.terminated_, l); |
| 109 l->append(" "); | 84 l->append(" "); |
| 110 LogParam(p.source_event_type_, l); | 85 LogParam(p.source_event_type_, l); |
| 111 } | 86 } |
| 112 | 87 |
| 113 } // namespace IPC | 88 } // namespace IPC |
| OLD | NEW |