Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: ui/events/mojo/latency_info_struct_traits.cc

Issue 2045723002: mojo ArrayTraits<T>::Resize returns bool indicating success (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed pach Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/mojo/latency_info_struct_traits.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 out->input_coordinates_size_ = 361 out->input_coordinates_size_ =
361 static_cast<uint32_t>(input_coordinate_array.size); 362 static_cast<uint32_t>(input_coordinate_array.size);
362 363
363 out->trace_id_ = data.trace_id(); 364 out->trace_id_ = data.trace_id();
364 out->coalesced_ = data.coalesced(); 365 out->coalesced_ = data.coalesced();
365 out->terminated_ = data.terminated(); 366 out->terminated_ = data.terminated();
366 return true; 367 return true;
367 } 368 }
368 369
369 } // namespace mojo 370 } // namespace mojo
OLDNEW
« no previous file with comments | « ui/events/mojo/latency_info_struct_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698