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

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

Issue 2039853004: Replace ui::LatencyInfo::InputCoordinate with gfx::PointF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing gyp dep Created 4 years, 6 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
« no previous file with comments | « ui/events/latency_info.h ('k') | ui/events/mojo/BUILD.gn » ('j') | 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 const unsigned char* latency_info_enabled; 130 const unsigned char* latency_info_enabled;
131 }; 131 };
132 132
133 static base::LazyInstance<LatencyInfoEnabledInitializer>::Leaky 133 static base::LazyInstance<LatencyInfoEnabledInitializer>::Leaky
134 g_latency_info_enabled = LAZY_INSTANCE_INITIALIZER; 134 g_latency_info_enabled = LAZY_INSTANCE_INITIALIZER;
135 135
136 } // namespace 136 } // namespace
137 137
138 namespace ui { 138 namespace ui {
139 139
140 LatencyInfo::InputCoordinate::InputCoordinate() : x(0), y(0) {
141 }
142
143 LatencyInfo::InputCoordinate::InputCoordinate(float x, float y) : x(x), y(y) {
144 }
145
146 LatencyInfo::LatencyInfo() 140 LatencyInfo::LatencyInfo()
147 : input_coordinates_size_(0), 141 : input_coordinates_size_(0),
148 trace_id_(-1), 142 trace_id_(-1),
149 coalesced_(false), 143 coalesced_(false),
150 terminated_(false) {} 144 terminated_(false) {}
151 145
152 LatencyInfo::LatencyInfo(const LatencyInfo& other) = default; 146 LatencyInfo::LatencyInfo(const LatencyInfo& other) = default;
153 147
154 LatencyInfo::~LatencyInfo() {} 148 LatencyInfo::~LatencyInfo() {}
155 149
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 record_data->SetDouble("trace_id", static_cast<double>(trace_id_)); 330 record_data->SetDouble("trace_id", static_cast<double>(trace_id_));
337 return LatencyInfoTracedValue::FromValue(std::move(record_data)); 331 return LatencyInfoTracedValue::FromValue(std::move(record_data));
338 } 332 }
339 333
340 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 334 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
341 LatencyInfo::CoordinatesAsTraceableData() { 335 LatencyInfo::CoordinatesAsTraceableData() {
342 std::unique_ptr<base::ListValue> coordinates(new base::ListValue()); 336 std::unique_ptr<base::ListValue> coordinates(new base::ListValue());
343 for (size_t i = 0; i < input_coordinates_size_; i++) { 337 for (size_t i = 0; i < input_coordinates_size_; i++) {
344 std::unique_ptr<base::DictionaryValue> coordinate_pair( 338 std::unique_ptr<base::DictionaryValue> coordinate_pair(
345 new base::DictionaryValue()); 339 new base::DictionaryValue());
346 coordinate_pair->SetDouble("x", input_coordinates_[i].x); 340 coordinate_pair->SetDouble("x", input_coordinates_[i].x());
347 coordinate_pair->SetDouble("y", input_coordinates_[i].y); 341 coordinate_pair->SetDouble("y", input_coordinates_[i].y());
348 coordinates->Append(coordinate_pair.release()); 342 coordinates->Append(coordinate_pair.release());
349 } 343 }
350 return LatencyInfoTracedValue::FromValue(std::move(coordinates)); 344 return LatencyInfoTracedValue::FromValue(std::move(coordinates));
351 } 345 }
352 346
353 bool LatencyInfo::FindLatency(LatencyComponentType type, 347 bool LatencyInfo::FindLatency(LatencyComponentType type,
354 int64_t id, 348 int64_t id,
355 LatencyComponent* output) const { 349 LatencyComponent* output) const {
356 LatencyMap::const_iterator it = latency_components_.find( 350 LatencyMap::const_iterator it = latency_components_.find(
357 std::make_pair(type, id)); 351 std::make_pair(type, id));
(...skipping 10 matching lines...) Expand all
368 if (it->first.first == type) { 362 if (it->first.first == type) {
369 LatencyMap::iterator tmp = it; 363 LatencyMap::iterator tmp = it;
370 ++it; 364 ++it;
371 latency_components_.erase(tmp); 365 latency_components_.erase(tmp);
372 } else { 366 } else {
373 it++; 367 it++;
374 } 368 }
375 } 369 }
376 } 370 }
377 371
378 bool LatencyInfo::AddInputCoordinate(const InputCoordinate& input_coordinate) { 372 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) {
379 if (input_coordinates_size_ >= kMaxInputCoordinates) 373 if (input_coordinates_size_ >= kMaxInputCoordinates)
380 return false; 374 return false;
381 input_coordinates_[input_coordinates_size_++] = input_coordinate; 375 input_coordinates_[input_coordinates_size_++] = input_coordinate;
382 return true; 376 return true;
383 } 377 }
384 378
385 } // namespace ui 379 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/latency_info.h ('k') | ui/events/mojo/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698