| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 LatencyInfo::InputCoordinate::InputCoordinate(float x, float y) : x(x), y(y) { | 131 LatencyInfo::InputCoordinate::InputCoordinate(float x, float y) : x(x), y(y) { |
| 132 } | 132 } |
| 133 | 133 |
| 134 LatencyInfo::LatencyInfo() | 134 LatencyInfo::LatencyInfo() |
| 135 : input_coordinates_size_(0), trace_id_(-1), terminated_(false) { | 135 : input_coordinates_size_(0), trace_id_(-1), terminated_(false) { |
| 136 } | 136 } |
| 137 | 137 |
| 138 LatencyInfo::~LatencyInfo() { | 138 LatencyInfo::~LatencyInfo() { |
| 139 } | 139 } |
| 140 | 140 |
| 141 LatencyInfo::LatencyInfo(int64 trace_id, bool terminated) |
| 142 : input_coordinates_size_(0), trace_id_(trace_id), terminated_(terminated) { |
| 143 } |
| 144 |
| 141 bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info, | 145 bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info, |
| 142 const char* referring_msg) { | 146 const char* referring_msg) { |
| 143 if (latency_info.size() > kMaxLatencyInfoNumber) { | 147 if (latency_info.size() > kMaxLatencyInfoNumber) { |
| 144 LOG(ERROR) << referring_msg << ", LatencyInfo vector size " | 148 LOG(ERROR) << referring_msg << ", LatencyInfo vector size " |
| 145 << latency_info.size() << " is too big."; | 149 << latency_info.size() << " is too big."; |
| 146 return false; | 150 return false; |
| 147 } | 151 } |
| 148 return true; | 152 return true; |
| 149 } | 153 } |
| 150 | 154 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 355 } |
| 352 | 356 |
| 353 bool LatencyInfo::AddInputCoordinate(const InputCoordinate& input_coordinate) { | 357 bool LatencyInfo::AddInputCoordinate(const InputCoordinate& input_coordinate) { |
| 354 if (input_coordinates_size_ >= kMaxInputCoordinates) | 358 if (input_coordinates_size_ >= kMaxInputCoordinates) |
| 355 return false; | 359 return false; |
| 356 input_coordinates_[input_coordinates_size_++] = input_coordinate; | 360 input_coordinates_[input_coordinates_size_++] = input_coordinate; |
| 357 return true; | 361 return true; |
| 358 } | 362 } |
| 359 | 363 |
| 360 } // namespace ui | 364 } // namespace ui |
| OLD | NEW |