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

Unified Diff: ui/events/latency_info.cc

Issue 541033003: Added coordinates information to InputLatency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses code style comments 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..2b1af78379f7d3e5775521b80605b7c6dedbd088 100644
--- a/ui/events/latency_info.cc
+++ b/ui/events/latency_info.cc
@@ -13,6 +13,7 @@
namespace {
const size_t kMaxLatencyInfoNumber = 100;
+const size_t kMaxCoordinatesNumber = 12;
const char* GetComponentName(ui::LatencyComponentType type) {
#define CASE_TYPE(t) case ui::t: return #t
@@ -117,6 +118,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.coordinates.size(); i++) {
+ scoped_ptr<base::DictionaryValue> coordinate_pair(
+ new base::DictionaryValue());
+ coordinate_pair->SetDouble("x", latency.coordinates[i].x());
+ coordinate_pair->SetDouble("y", latency.coordinates[i].y());
+ coordinates->Append(coordinate_pair.release());
+ }
+ record_data->Set("coordinates", coordinates.release());
return LatencyInfoTracedValue::FromValue(record_data.PassAs<base::Value>());
}
@@ -137,6 +148,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].coordinates.size() > kMaxCoordinatesNumber) {
+ LOG(ERROR) << referring_msg << ", coordinates vector size "
+ << latency_info[i].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