Chromium Code Reviews| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 : input_coordinates_size_(0), | 142 : input_coordinates_size_(0), |
| 143 trace_id_(-1), | 143 trace_id_(-1), |
| 144 coalesced_(false), | 144 coalesced_(false), |
| 145 terminated_(false) {} | 145 terminated_(false), |
| 146 source_event_type_(SourceEventType::UNKOWN) {} | |
|
tdresser
2016/09/12 14:23:08
Use a delegated constructor here.
(https://www.ib
sahel
2016/09/12 17:02:26
Done.
| |
| 147 | |
| 148 LatencyInfo::LatencyInfo(SourceEventType type) | |
| 149 : input_coordinates_size_(0), | |
| 150 trace_id_(-1), | |
| 151 coalesced_(false), | |
| 152 terminated_(false), | |
| 153 source_event_type_(type) {} | |
| 146 | 154 |
| 147 LatencyInfo::LatencyInfo(const LatencyInfo& other) = default; | 155 LatencyInfo::LatencyInfo(const LatencyInfo& other) = default; |
| 148 | 156 |
| 149 LatencyInfo::~LatencyInfo() {} | 157 LatencyInfo::~LatencyInfo() {} |
| 150 | 158 |
| 151 LatencyInfo::LatencyInfo(int64_t trace_id, bool terminated) | 159 LatencyInfo::LatencyInfo(int64_t trace_id, bool terminated) |
| 152 : input_coordinates_size_(0), | 160 : input_coordinates_size_(0), |
| 153 trace_id_(trace_id), | 161 trace_id_(trace_id), |
| 154 terminated_(terminated) {} | 162 terminated_(terminated), |
| 163 source_event_type_(SourceEventType::UNKOWN) {} | |
| 155 | 164 |
| 156 bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info, | 165 bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info, |
| 157 const char* referring_msg) { | 166 const char* referring_msg) { |
| 158 if (latency_info.size() > kMaxLatencyInfoNumber) { | 167 if (latency_info.size() > kMaxLatencyInfoNumber) { |
| 159 LOG(ERROR) << referring_msg << ", LatencyInfo vector size " | 168 LOG(ERROR) << referring_msg << ", LatencyInfo vector size " |
| 160 << latency_info.size() << " is too big."; | 169 << latency_info.size() << " is too big."; |
| 161 TRACE_EVENT_INSTANT1("input,benchmark", "LatencyInfo::Verify Fails", | 170 TRACE_EVENT_INSTANT1("input,benchmark", "LatencyInfo::Verify Fails", |
| 162 TRACE_EVENT_SCOPE_GLOBAL, | 171 TRACE_EVENT_SCOPE_GLOBAL, |
| 163 "size", latency_info.size()); | 172 "size", latency_info.size()); |
| 164 return false; | 173 return false; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 } | 377 } |
| 369 | 378 |
| 370 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) { | 379 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) { |
| 371 if (input_coordinates_size_ >= kMaxInputCoordinates) | 380 if (input_coordinates_size_ >= kMaxInputCoordinates) |
| 372 return false; | 381 return false; |
| 373 input_coordinates_[input_coordinates_size_++] = input_coordinate; | 382 input_coordinates_[input_coordinates_size_++] = input_coordinate; |
| 374 return true; | 383 return true; |
| 375 } | 384 } |
| 376 | 385 |
| 377 } // namespace ui | 386 } // namespace ui |
| OLD | NEW |