| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 case ui::mojom::SourceEventType::OTHER: | 182 case ui::mojom::SourceEventType::OTHER: |
| 183 return ui::OTHER; | 183 return ui::OTHER; |
| 184 } | 184 } |
| 185 NOTREACHED(); | 185 NOTREACHED(); |
| 186 return ui::SourceEventType::UNKNOWN; | 186 return ui::SourceEventType::UNKNOWN; |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace | 189 } // namespace |
| 190 | 190 |
| 191 // static | 191 // static |
| 192 int64_t StructTraits<ui::mojom::LatencyComponentDataView, | |
| 193 ui::LatencyInfo::LatencyComponent>:: | |
| 194 sequence_number(const ui::LatencyInfo::LatencyComponent& component) { | |
| 195 return component.sequence_number; | |
| 196 } | |
| 197 | |
| 198 // static | |
| 199 base::TimeTicks StructTraits<ui::mojom::LatencyComponentDataView, | 192 base::TimeTicks StructTraits<ui::mojom::LatencyComponentDataView, |
| 200 ui::LatencyInfo::LatencyComponent>:: | 193 ui::LatencyInfo::LatencyComponent>:: |
| 201 event_time(const ui::LatencyInfo::LatencyComponent& component) { | 194 event_time(const ui::LatencyInfo::LatencyComponent& component) { |
| 202 return component.event_time; | 195 return component.event_time; |
| 203 } | 196 } |
| 204 | 197 |
| 205 // static | 198 // static |
| 206 uint32_t StructTraits<ui::mojom::LatencyComponentDataView, | 199 uint32_t StructTraits<ui::mojom::LatencyComponentDataView, |
| 207 ui::LatencyInfo::LatencyComponent>:: | 200 ui::LatencyInfo::LatencyComponent>:: |
| 208 event_count(const ui::LatencyInfo::LatencyComponent& component) { | 201 event_count(const ui::LatencyInfo::LatencyComponent& component) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 227 bool StructTraits<ui::mojom::LatencyComponentDataView, | 220 bool StructTraits<ui::mojom::LatencyComponentDataView, |
| 228 ui::LatencyInfo::LatencyComponent>:: | 221 ui::LatencyInfo::LatencyComponent>:: |
| 229 Read(ui::mojom::LatencyComponentDataView data, | 222 Read(ui::mojom::LatencyComponentDataView data, |
| 230 ui::LatencyInfo::LatencyComponent* out) { | 223 ui::LatencyInfo::LatencyComponent* out) { |
| 231 if (!data.ReadEventTime(&out->event_time)) | 224 if (!data.ReadEventTime(&out->event_time)) |
| 232 return false; | 225 return false; |
| 233 if (!data.ReadFirstEventTime(&out->first_event_time)) | 226 if (!data.ReadFirstEventTime(&out->first_event_time)) |
| 234 return false; | 227 return false; |
| 235 if (!data.ReadLastEventTime(&out->last_event_time)) | 228 if (!data.ReadLastEventTime(&out->last_event_time)) |
| 236 return false; | 229 return false; |
| 237 out->sequence_number = data.sequence_number(); | |
| 238 out->event_count = data.event_count(); | 230 out->event_count = data.event_count(); |
| 239 return true; | 231 return true; |
| 240 } | 232 } |
| 241 | 233 |
| 242 // static | 234 // static |
| 243 ui::mojom::LatencyComponentType | 235 ui::mojom::LatencyComponentType |
| 244 StructTraits<ui::mojom::LatencyComponentIdDataView, | 236 StructTraits<ui::mojom::LatencyComponentIdDataView, |
| 245 std::pair<ui::LatencyComponentType, int64_t>>:: | 237 std::pair<ui::LatencyComponentType, int64_t>>:: |
| 246 type(const std::pair<ui::LatencyComponentType, int64_t>& id) { | 238 type(const std::pair<ui::LatencyComponentType, int64_t>& id) { |
| 247 return UILatencyComponentTypeToMojo(id.first); | 239 return UILatencyComponentTypeToMojo(id.first); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 out->coalesced_ = data.coalesced(); | 331 out->coalesced_ = data.coalesced(); |
| 340 out->began_ = data.began(); | 332 out->began_ = data.began(); |
| 341 out->terminated_ = data.terminated(); | 333 out->terminated_ = data.terminated(); |
| 342 out->source_event_type_ = MojoSourceEventTypeToUI(data.source_event_type()); | 334 out->source_event_type_ = MojoSourceEventTypeToUI(data.source_event_type()); |
| 343 | 335 |
| 344 return data.ReadExpectedQueueingTimeOnDispatch( | 336 return data.ReadExpectedQueueingTimeOnDispatch( |
| 345 &out->expected_queueing_time_on_dispatch_); | 337 &out->expected_queueing_time_on_dispatch_); |
| 346 } | 338 } |
| 347 | 339 |
| 348 } // namespace mojo | 340 } // namespace mojo |
| OLD | NEW |