OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/latency_info.h" | 5 #include "ui/events/latency_info.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 332 } |
333 | 333 |
334 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 334 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
335 LatencyInfo::CoordinatesAsTraceableData() { | 335 LatencyInfo::CoordinatesAsTraceableData() { |
336 std::unique_ptr<base::ListValue> coordinates(new base::ListValue()); | 336 std::unique_ptr<base::ListValue> coordinates(new base::ListValue()); |
337 for (size_t i = 0; i < input_coordinates_size_; i++) { | 337 for (size_t i = 0; i < input_coordinates_size_; i++) { |
338 std::unique_ptr<base::DictionaryValue> coordinate_pair( | 338 std::unique_ptr<base::DictionaryValue> coordinate_pair( |
339 new base::DictionaryValue()); | 339 new base::DictionaryValue()); |
340 coordinate_pair->SetDouble("x", input_coordinates_[i].x()); | 340 coordinate_pair->SetDouble("x", input_coordinates_[i].x()); |
341 coordinate_pair->SetDouble("y", input_coordinates_[i].y()); | 341 coordinate_pair->SetDouble("y", input_coordinates_[i].y()); |
342 coordinates->Append(coordinate_pair.release()); | 342 coordinates->Append(std::move(coordinate_pair)); |
343 } | 343 } |
344 return LatencyInfoTracedValue::FromValue(std::move(coordinates)); | 344 return LatencyInfoTracedValue::FromValue(std::move(coordinates)); |
345 } | 345 } |
346 | 346 |
347 bool LatencyInfo::FindLatency(LatencyComponentType type, | 347 bool LatencyInfo::FindLatency(LatencyComponentType type, |
348 int64_t id, | 348 int64_t id, |
349 LatencyComponent* output) const { | 349 LatencyComponent* output) const { |
350 LatencyMap::const_iterator it = latency_components_.find( | 350 LatencyMap::const_iterator it = latency_components_.find( |
351 std::make_pair(type, id)); | 351 std::make_pair(type, id)); |
352 if (it == latency_components_.end()) | 352 if (it == latency_components_.end()) |
(...skipping 17 matching lines...) Expand all Loading... |
370 } | 370 } |
371 | 371 |
372 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) { | 372 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) { |
373 if (input_coordinates_size_ >= kMaxInputCoordinates) | 373 if (input_coordinates_size_ >= kMaxInputCoordinates) |
374 return false; | 374 return false; |
375 input_coordinates_[input_coordinates_size_++] = input_coordinate; | 375 input_coordinates_[input_coordinates_size_++] = input_coordinate; |
376 return true; | 376 return true; |
377 } | 377 } |
378 | 378 |
379 } // namespace ui | 379 } // namespace ui |
OLD | NEW |