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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 297 } |
298 | 298 |
299 // static | 299 // static |
300 ui::mojom::SourceEventType | 300 ui::mojom::SourceEventType |
301 StructTraits<ui::mojom::LatencyInfoDataView, | 301 StructTraits<ui::mojom::LatencyInfoDataView, |
302 ui::LatencyInfo>::source_event_type(const ui::LatencyInfo& info) { | 302 ui::LatencyInfo>::source_event_type(const ui::LatencyInfo& info) { |
303 return UISourceEventTypeToMojo(info.source_event_type()); | 303 return UISourceEventTypeToMojo(info.source_event_type()); |
304 } | 304 } |
305 | 305 |
306 // static | 306 // static |
| 307 base::TimeDelta StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>:: |
| 308 expected_queueing_time_on_dispatch(const ui::LatencyInfo& info) { |
| 309 return info.expected_queueing_time_on_dispatch(); |
| 310 } |
| 311 |
| 312 // static |
307 bool StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::Read( | 313 bool StructTraits<ui::mojom::LatencyInfoDataView, ui::LatencyInfo>::Read( |
308 ui::mojom::LatencyInfoDataView data, | 314 ui::mojom::LatencyInfoDataView data, |
309 ui::LatencyInfo* out) { | 315 ui::LatencyInfo* out) { |
310 if (!data.ReadTraceName(&out->trace_name_)) | 316 if (!data.ReadTraceName(&out->trace_name_)) |
311 return false; | 317 return false; |
312 | 318 |
313 mojo::ArrayDataView<ui::mojom::LatencyComponentPairDataView> components; | 319 mojo::ArrayDataView<ui::mojom::LatencyComponentPairDataView> components; |
314 data.GetLatencyComponentsDataView(&components); | 320 data.GetLatencyComponentsDataView(&components); |
315 for (uint32_t i = 0; i < components.size(); ++i) { | 321 for (uint32_t i = 0; i < components.size(); ++i) { |
316 ui::mojom::LatencyComponentPairDataView component_pair; | 322 ui::mojom::LatencyComponentPairDataView component_pair; |
317 components.GetDataView(i, &component_pair); | 323 components.GetDataView(i, &component_pair); |
318 ui::LatencyInfo::LatencyMap::key_type key; | 324 ui::LatencyInfo::LatencyMap::key_type key; |
319 if (!component_pair.ReadKey(&key)) | 325 if (!component_pair.ReadKey(&key)) |
320 return false; | 326 return false; |
321 auto& value = out->latency_components_[key]; | 327 auto& value = out->latency_components_[key]; |
322 if (!component_pair.ReadValue(&value)) | 328 if (!component_pair.ReadValue(&value)) |
323 return false; | 329 return false; |
324 } | 330 } |
325 | 331 |
326 out->trace_id_ = data.trace_id(); | 332 out->trace_id_ = data.trace_id(); |
327 out->coalesced_ = data.coalesced(); | 333 out->coalesced_ = data.coalesced(); |
328 out->terminated_ = data.terminated(); | 334 out->terminated_ = data.terminated(); |
329 out->source_event_type_ = MojoSourceEventTypeToUI(data.source_event_type()); | 335 out->source_event_type_ = MojoSourceEventTypeToUI(data.source_event_type()); |
330 return true; | 336 |
| 337 return data.ReadExpectedQueueingTimeOnDispatch( |
| 338 &out->expected_queueing_time_on_dispatch_); |
331 } | 339 } |
332 | 340 |
333 } // namespace mojo | 341 } // namespace mojo |
OLD | NEW |