Index: ui/events/latency_info.cc |
diff --git a/ui/events/latency_info.cc b/ui/events/latency_info.cc |
index a3a11828db041ee90e844c9076a4d3bd70fb24e3..dd5e11c3141899d3a1350a6def8fc30950b4a281 100644 |
--- a/ui/events/latency_info.cc |
+++ b/ui/events/latency_info.cc |
@@ -11,6 +11,9 @@ |
#include <algorithm> |
namespace { |
+ |
+const unsigned int kMaxLatencyInfoNumber = 100; |
+ |
const char* GetComponentName(ui::LatencyComponentType type) { |
#define CASE_TYPE(t) case ui::t: return #t |
switch (type) { |
@@ -119,6 +122,16 @@ LatencyInfo::LatencyInfo() : trace_id(-1), terminated(false) { |
LatencyInfo::~LatencyInfo() { |
} |
+bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info, |
+ const char* referring_msg) { |
+ if (latency_info.size() > kMaxLatencyInfoNumber) { |
+ LOG(ERROR) << referring_msg << ", LatencyInfo vector size " |
+ << latency_info.size() << " is too big."; |
+ return false; |
+ } |
+ return true; |
+} |
+ |
void LatencyInfo::MergeWith(const LatencyInfo& other) { |
for (LatencyMap::const_iterator it = other.latency_components.begin(); |
it != other.latency_components.end(); |