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

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

Issue 2048673002: Revert of Replace ui::LatencyInfo::InputCoordinate with gfx::PointF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
140 LatencyInfo::LatencyInfo() 146 LatencyInfo::LatencyInfo()
141 : input_coordinates_size_(0), 147 : input_coordinates_size_(0),
142 trace_id_(-1), 148 trace_id_(-1),
143 coalesced_(false), 149 coalesced_(false),
144 terminated_(false) {} 150 terminated_(false) {}
145 151
146 LatencyInfo::LatencyInfo(const LatencyInfo& other) = default; 152 LatencyInfo::LatencyInfo(const LatencyInfo& other) = default;
147 153
148 LatencyInfo::~LatencyInfo() {} 154 LatencyInfo::~LatencyInfo() {}
149 155
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 record_data->SetDouble("trace_id", static_cast<double>(trace_id_)); 336 record_data->SetDouble("trace_id", static_cast<double>(trace_id_));
331 return LatencyInfoTracedValue::FromValue(std::move(record_data)); 337 return LatencyInfoTracedValue::FromValue(std::move(record_data));
332 } 338 }
333 339
334 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 340 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
335 LatencyInfo::CoordinatesAsTraceableData() { 341 LatencyInfo::CoordinatesAsTraceableData() {
336 std::unique_ptr<base::ListValue> coordinates(new base::ListValue()); 342 std::unique_ptr<base::ListValue> coordinates(new base::ListValue());
337 for (size_t i = 0; i < input_coordinates_size_; i++) { 343 for (size_t i = 0; i < input_coordinates_size_; i++) {
338 std::unique_ptr<base::DictionaryValue> coordinate_pair( 344 std::unique_ptr<base::DictionaryValue> coordinate_pair(
339 new base::DictionaryValue()); 345 new base::DictionaryValue());
340 coordinate_pair->SetDouble("x", input_coordinates_[i].x()); 346 coordinate_pair->SetDouble("x", input_coordinates_[i].x);
341 coordinate_pair->SetDouble("y", input_coordinates_[i].y()); 347 coordinate_pair->SetDouble("y", input_coordinates_[i].y);
342 coordinates->Append(coordinate_pair.release()); 348 coordinates->Append(coordinate_pair.release());
343 } 349 }
344 return LatencyInfoTracedValue::FromValue(std::move(coordinates)); 350 return LatencyInfoTracedValue::FromValue(std::move(coordinates));
345 } 351 }
346 352
347 bool LatencyInfo::FindLatency(LatencyComponentType type, 353 bool LatencyInfo::FindLatency(LatencyComponentType type,
348 int64_t id, 354 int64_t id,
349 LatencyComponent* output) const { 355 LatencyComponent* output) const {
350 LatencyMap::const_iterator it = latency_components_.find( 356 LatencyMap::const_iterator it = latency_components_.find(
351 std::make_pair(type, id)); 357 std::make_pair(type, id));
(...skipping 10 matching lines...) Expand all
362 if (it->first.first == type) { 368 if (it->first.first == type) {
363 LatencyMap::iterator tmp = it; 369 LatencyMap::iterator tmp = it;
364 ++it; 370 ++it;
365 latency_components_.erase(tmp); 371 latency_components_.erase(tmp);
366 } else { 372 } else {
367 it++; 373 it++;
368 } 374 }
369 } 375 }
370 } 376 }
371 377
372 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) { 378 bool LatencyInfo::AddInputCoordinate(const InputCoordinate& input_coordinate) {
373 if (input_coordinates_size_ >= kMaxInputCoordinates) 379 if (input_coordinates_size_ >= kMaxInputCoordinates)
374 return false; 380 return false;
375 input_coordinates_[input_coordinates_size_++] = input_coordinate; 381 input_coordinates_[input_coordinates_size_++] = input_coordinate;
376 return true; 382 return true;
377 } 383 }
378 384
379 } // namespace ui 385 } // 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