Index: ui/events/mojo/latency_info_struct_traits.cc |
diff --git a/ui/events/mojo/latency_info_struct_traits.cc b/ui/events/mojo/latency_info_struct_traits.cc |
index 78705c2c16df602e03ef09aa395d44658c3a198a..63b01995049cc93792c5112249433985adad4c6d 100644 |
--- a/ui/events/mojo/latency_info_struct_traits.cc |
+++ b/ui/events/mojo/latency_info_struct_traits.cc |
@@ -276,12 +276,18 @@ bool StructTraits<ui::mojom::LatencyInfo, ui::LatencyInfo>::Read( |
if (!data.ReadTraceName(&out->trace_name_)) |
return false; |
- // TODO(fsamuel): Figure out how to optimize deserialization. |
- mojo::Array<ui::mojom::LatencyComponentPairPtr> components; |
- if (!data.ReadLatencyComponents(&components)) |
- return false; |
- for (uint32_t i = 0; i < components.size(); ++i) |
- out->latency_components_[components[i]->key] = components[i]->value; |
+ mojo::ArrayDataView<ui::mojom::LatencyComponentPairDataView> components; |
+ data.GetLatencyComponentsDataView(&components); |
+ for (uint32_t i = 0; i < components.size(); ++i) { |
+ ui::mojom::LatencyComponentPairDataView component_pair; |
+ components.GetDataView(i, &component_pair); |
yzshen1
2016/08/23 21:23:05
This change itself LGTM.
Performance fyi: It woul
|
+ ui::LatencyInfo::LatencyMap::key_type key; |
+ if (!component_pair.ReadKey(&key)) |
+ return false; |
+ auto& value = out->latency_components_[key]; |
+ if (!component_pair.ReadValue(&value)) |
+ return false; |
+ } |
InputCoordinateArray input_coordinate_array = { |
0, ui::LatencyInfo::kMaxInputCoordinates, out->input_coordinates_}; |