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

Unified Diff: ui/events/latency_info.cc

Issue 569653002: Add input coordinate information to InputLatency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch to float array. Created 6 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 side-by-side diff with in-line comments
Download patch
« ui/events/latency_info.h ('K') | « ui/events/latency_info.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/latency_info.cc
diff --git a/ui/events/latency_info.cc b/ui/events/latency_info.cc
index 4e817d06432107f2f6a45861ab30b39fefad0b68..94e1a619e2755854bc04051408d6c67362de6577 100644
--- a/ui/events/latency_info.cc
+++ b/ui/events/latency_info.cc
@@ -117,6 +117,16 @@ scoped_refptr<base::debug::ConvertableToTraceFormat> AsTraceableData(
record_data->Set(GetComponentName(it->first.first), component_info);
}
record_data->SetDouble("trace_id", latency.trace_id);
+
+ scoped_ptr<base::ListValue> coordinates(new base::ListValue());
+ for (size_t i = 0; i < latency.input_coordinates_size; i++) {
+ scoped_ptr<base::DictionaryValue> coordinate_pair(
+ new base::DictionaryValue());
+ coordinate_pair->SetDouble("x", latency.input_coordinates[i][0]);
+ coordinate_pair->SetDouble("y", latency.input_coordinates[i][1]);
+ coordinates->Append(coordinate_pair.release());
+ }
+ record_data->Set("coordinates", coordinates.release());
return LatencyInfoTracedValue::FromValue(record_data.PassAs<base::Value>());
}
@@ -124,7 +134,11 @@ scoped_refptr<base::debug::ConvertableToTraceFormat> AsTraceableData(
namespace ui {
-LatencyInfo::LatencyInfo() : trace_id(-1), terminated(false) {
+LatencyInfo::LatencyInfo()
+ : input_coordinates_size(0), trace_id(-1), terminated(false) {
+ for (size_t i = 0; i < arraysize(input_coordinates); ++i)
+ for (size_t j = 0; j < arraysize(input_coordinates[i]); ++j)
+ input_coordinates[i][j] = 0;
}
LatencyInfo::~LatencyInfo() {
@@ -137,6 +151,14 @@ bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info,
<< latency_info.size() << " is too big.";
return false;
}
+ for (size_t i = 0; i < latency_info.size(); i++) {
+ if (latency_info[i].input_coordinates_size > kMaxInputCoordinates) {
+ LOG(ERROR) << referring_msg << ", coordinate vector size "
+ << latency_info[i].input_coordinates_size << " is too big.";
+ return false;
+ }
+ }
+
return true;
}
« ui/events/latency_info.h ('K') | « ui/events/latency_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698