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