OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/latency/mojo/latency_info_struct_traits.h" | 5 #include "ui/latency/mojo/latency_info_struct_traits.h" |
6 | 6 |
7 #include "ipc/ipc_message_utils.h" | 7 #include "ipc/ipc_message_utils.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::trace_name( | 235 StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::trace_name( |
236 const ui::LatencyInfo& info) { | 236 const ui::LatencyInfo& info) { |
237 return info.trace_name_; | 237 return info.trace_name_; |
238 } | 238 } |
239 | 239 |
240 const ui::LatencyInfo::LatencyMap& | 240 const ui::LatencyInfo::LatencyMap& |
241 StructTraits<ui::mojom::LatencyInfoDataView, | 241 StructTraits<ui::mojom::LatencyInfoDataView, |
242 ui::LatencyInfo>::latency_components(const ui::LatencyInfo& info) { | 242 ui::LatencyInfo>::latency_components(const ui::LatencyInfo& info) { |
243 return info.latency_components(); | 243 return info.latency_components(); |
244 } | 244 } |
245 InputCoordinateArray | |
246 StructTraits<ui::mojom::LatencyInfoDataView, | |
mfomitchev
2017/04/06 21:40:53
You should update .h for struct traits as well.
| |
247 ui::LatencyInfo>::input_coordinates(const ui::LatencyInfo& info) { | |
248 return {info.input_coordinates_size_, ui::LatencyInfo::kMaxInputCoordinates, | |
249 const_cast<gfx::PointF*>(info.input_coordinates_)}; | |
250 } | |
251 | 245 |
252 int64_t StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::trace_id( | 246 int64_t StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::trace_id( |
253 const ui::LatencyInfo& info) { | 247 const ui::LatencyInfo& info) { |
254 return info.trace_id(); | 248 return info.trace_id(); |
255 } | 249 } |
256 | 250 |
257 bool StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::coalesced( | 251 bool StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::coalesced( |
258 const ui::LatencyInfo& info) { | 252 const ui::LatencyInfo& info) { |
259 return info.coalesced(); | 253 return info.coalesced(); |
260 } | 254 } |
(...skipping 15 matching lines...) Expand all Loading... | |
276 ui::mojom::LatencyComponentPairDataView component_pair; | 270 ui::mojom::LatencyComponentPairDataView component_pair; |
277 components.GetDataView(i, &component_pair); | 271 components.GetDataView(i, &component_pair); |
278 ui::LatencyInfo::LatencyMap::key_type key; | 272 ui::LatencyInfo::LatencyMap::key_type key; |
279 if (!component_pair.ReadKey(&key)) | 273 if (!component_pair.ReadKey(&key)) |
280 return false; | 274 return false; |
281 auto& value = out->latency_components_[key]; | 275 auto& value = out->latency_components_[key]; |
282 if (!component_pair.ReadValue(&value)) | 276 if (!component_pair.ReadValue(&value)) |
283 return false; | 277 return false; |
284 } | 278 } |
285 | 279 |
286 InputCoordinateArray input_coordinate_array = { | |
287 0, ui::LatencyInfo::kMaxInputCoordinates, out->input_coordinates_}; | |
288 if (!data.ReadInputCoordinates(&input_coordinate_array)) | |
289 return false; | |
290 // TODO(fsamuel): ui::LatencyInfo::input_coordinates_size_ should be a size_t. | |
291 out->input_coordinates_size_ = | |
292 static_cast<uint32_t>(input_coordinate_array.size); | |
293 | |
294 out->trace_id_ = data.trace_id(); | 280 out->trace_id_ = data.trace_id(); |
295 out->coalesced_ = data.coalesced(); | 281 out->coalesced_ = data.coalesced(); |
296 out->terminated_ = data.terminated(); | 282 out->terminated_ = data.terminated(); |
297 return true; | 283 return true; |
298 } | 284 } |
299 | 285 |
300 } // namespace mojo | 286 } // namespace mojo |
OLD | NEW |