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

Side by Side Diff: ui/events/latency_info.cc

Issue 2317253005: SourceEventType added to LatencyInfo (Closed)
Patch Set: unittest added for source type assignment for pointerEvents. Created 4 years, 3 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
« ui/events/event.cc ('K') | « ui/events/latency_info.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 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 const unsigned char* latency_info_enabled; 131 const unsigned char* latency_info_enabled;
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() : LatencyInfo(SourceEventType::UNKNOWN) {}
142
143 LatencyInfo::LatencyInfo(SourceEventType type)
142 : input_coordinates_size_(0), 144 : input_coordinates_size_(0),
143 trace_id_(-1), 145 trace_id_(-1),
144 coalesced_(false), 146 coalesced_(false),
145 terminated_(false) {} 147 terminated_(false),
148 source_event_type_(type) {}
146 149
147 LatencyInfo::LatencyInfo(const LatencyInfo& other) = default; 150 LatencyInfo::LatencyInfo(const LatencyInfo& other) = default;
148 151
149 LatencyInfo::~LatencyInfo() {} 152 LatencyInfo::~LatencyInfo() {}
150 153
151 LatencyInfo::LatencyInfo(int64_t trace_id, bool terminated) 154 LatencyInfo::LatencyInfo(int64_t trace_id, bool terminated)
152 : input_coordinates_size_(0), 155 : input_coordinates_size_(0),
153 trace_id_(trace_id), 156 trace_id_(trace_id),
154 terminated_(terminated) {} 157 terminated_(terminated),
158 source_event_type_(SourceEventType::UNKNOWN) {}
155 159
156 bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info, 160 bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info,
157 const char* referring_msg) { 161 const char* referring_msg) {
158 if (latency_info.size() > kMaxLatencyInfoNumber) { 162 if (latency_info.size() > kMaxLatencyInfoNumber) {
159 LOG(ERROR) << referring_msg << ", LatencyInfo vector size " 163 LOG(ERROR) << referring_msg << ", LatencyInfo vector size "
160 << latency_info.size() << " is too big."; 164 << latency_info.size() << " is too big.";
161 TRACE_EVENT_INSTANT1("input,benchmark", "LatencyInfo::Verify Fails", 165 TRACE_EVENT_INSTANT1("input,benchmark", "LatencyInfo::Verify Fails",
162 TRACE_EVENT_SCOPE_GLOBAL, 166 TRACE_EVENT_SCOPE_GLOBAL,
163 "size", latency_info.size()); 167 "size", latency_info.size());
164 return false; 168 return false;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 372 }
369 373
370 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) { 374 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) {
371 if (input_coordinates_size_ >= kMaxInputCoordinates) 375 if (input_coordinates_size_ >= kMaxInputCoordinates)
372 return false; 376 return false;
373 input_coordinates_[input_coordinates_size_++] = input_coordinate; 377 input_coordinates_[input_coordinates_size_++] = input_coordinate;
374 return true; 378 return true;
375 } 379 }
376 380
377 } // namespace ui 381 } // namespace ui
OLDNEW
« ui/events/event.cc ('K') | « ui/events/latency_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698