| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 static base::LazyInstance<LatencyInfoEnabledInitializer>::Leaky | 134 static base::LazyInstance<LatencyInfoEnabledInitializer>::Leaky |
| 135 g_latency_info_enabled = LAZY_INSTANCE_INITIALIZER; | 135 g_latency_info_enabled = LAZY_INSTANCE_INITIALIZER; |
| 136 | 136 |
| 137 } // namespace | 137 } // namespace |
| 138 | 138 |
| 139 namespace ui { | 139 namespace ui { |
| 140 | 140 |
| 141 LatencyInfo::LatencyInfo() | 141 LatencyInfo::LatencyInfo() |
| 142 : LatencyInfo(SourceEventType::UNKOWN) {} |
| 143 |
| 144 LatencyInfo::LatencyInfo(SourceEventType type) |
| 142 : input_coordinates_size_(0), | 145 : input_coordinates_size_(0), |
| 143 trace_id_(-1), | 146 trace_id_(-1), |
| 144 coalesced_(false), | 147 coalesced_(false), |
| 145 terminated_(false) {} | 148 terminated_(false), |
| 149 source_event_type_(type) {} |
| 146 | 150 |
| 147 LatencyInfo::LatencyInfo(const LatencyInfo& other) = default; | 151 LatencyInfo::LatencyInfo(const LatencyInfo& other) = default; |
| 148 | 152 |
| 149 LatencyInfo::~LatencyInfo() {} | 153 LatencyInfo::~LatencyInfo() {} |
| 150 | 154 |
| 151 LatencyInfo::LatencyInfo(int64_t trace_id, bool terminated) | 155 LatencyInfo::LatencyInfo(int64_t trace_id, bool terminated) |
| 152 : input_coordinates_size_(0), | 156 : input_coordinates_size_(0), |
| 153 trace_id_(trace_id), | 157 trace_id_(trace_id), |
| 154 terminated_(terminated) {} | 158 terminated_(terminated), |
| 159 source_event_type_(SourceEventType::UNKOWN) {} |
| 155 | 160 |
| 156 bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info, | 161 bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info, |
| 157 const char* referring_msg) { | 162 const char* referring_msg) { |
| 158 if (latency_info.size() > kMaxLatencyInfoNumber) { | 163 if (latency_info.size() > kMaxLatencyInfoNumber) { |
| 159 LOG(ERROR) << referring_msg << ", LatencyInfo vector size " | 164 LOG(ERROR) << referring_msg << ", LatencyInfo vector size " |
| 160 << latency_info.size() << " is too big."; | 165 << latency_info.size() << " is too big."; |
| 161 TRACE_EVENT_INSTANT1("input,benchmark", "LatencyInfo::Verify Fails", | 166 TRACE_EVENT_INSTANT1("input,benchmark", "LatencyInfo::Verify Fails", |
| 162 TRACE_EVENT_SCOPE_GLOBAL, | 167 TRACE_EVENT_SCOPE_GLOBAL, |
| 163 "size", latency_info.size()); | 168 "size", latency_info.size()); |
| 164 return false; | 169 return false; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 373 } |
| 369 | 374 |
| 370 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) { | 375 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) { |
| 371 if (input_coordinates_size_ >= kMaxInputCoordinates) | 376 if (input_coordinates_size_ >= kMaxInputCoordinates) |
| 372 return false; | 377 return false; |
| 373 input_coordinates_[input_coordinates_size_++] = input_coordinate; | 378 input_coordinates_[input_coordinates_size_++] = input_coordinate; |
| 374 return true; | 379 return true; |
| 375 } | 380 } |
| 376 | 381 |
| 377 } // namespace ui | 382 } // namespace ui |
| OLD | NEW |