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/events/mojo/latency_info_struct_traits.h" | 5 #include "ui/events/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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 204 } |
205 | 205 |
206 // static | 206 // static |
207 const ui::LatencyInfo::InputCoordinate& | 207 const ui::LatencyInfo::InputCoordinate& |
208 ArrayTraits<InputCoordinateArray>::GetAt(const InputCoordinateArray& b, | 208 ArrayTraits<InputCoordinateArray>::GetAt(const InputCoordinateArray& b, |
209 size_t i) { | 209 size_t i) { |
210 return b.data[i]; | 210 return b.data[i]; |
211 } | 211 } |
212 | 212 |
213 // static | 213 // static |
214 void ArrayTraits<InputCoordinateArray>::Resize(InputCoordinateArray& b, | 214 bool ArrayTraits<InputCoordinateArray>::Resize(InputCoordinateArray& b, |
215 size_t size) { | 215 size_t size) { |
216 // TODO(fsamuel): We should update ArrayTraits<T>::Resize to return a bool. | 216 if (size > ui::LatencyInfo::kMaxInputCoordinates) |
217 CHECK_LE(size, ui::LatencyInfo::kMaxInputCoordinates); | 217 return false; |
218 b.size = size; | 218 b.size = size; |
| 219 return true; |
219 } | 220 } |
220 | 221 |
221 // static | 222 // static |
222 int64_t | 223 int64_t |
223 StructTraits<ui::mojom::LatencyComponent, ui::LatencyInfo::LatencyComponent>:: | 224 StructTraits<ui::mojom::LatencyComponent, ui::LatencyInfo::LatencyComponent>:: |
224 sequence_number(const ui::LatencyInfo::LatencyComponent& component) { | 225 sequence_number(const ui::LatencyInfo::LatencyComponent& component) { |
225 return component.sequence_number; | 226 return component.sequence_number; |
226 } | 227 } |
227 | 228 |
228 // static | 229 // static |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 return false; | 359 return false; |
359 out->input_coordinates_size_ = input_coordinate_array.size; | 360 out->input_coordinates_size_ = input_coordinate_array.size; |
360 | 361 |
361 out->trace_id_ = data.trace_id(); | 362 out->trace_id_ = data.trace_id(); |
362 out->coalesced_ = data.coalesced(); | 363 out->coalesced_ = data.coalesced(); |
363 out->terminated_ = data.terminated(); | 364 out->terminated_ = data.terminated(); |
364 return true; | 365 return true; |
365 } | 366 } |
366 | 367 |
367 } // namespace mojo | 368 } // namespace mojo |
OLD | NEW |