OLD | NEW |
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 "base/debug/trace_event.h" | 5 #include "base/debug/trace_event.h" |
6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "ui/events/latency_info.h" | 9 #include "ui/events/latency_info.h" |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } // namespace | 112 } // namespace |
113 | 113 |
114 namespace ui { | 114 namespace ui { |
115 | 115 |
116 LatencyInfo::LatencyInfo() : trace_id(-1), terminated(false) { | 116 LatencyInfo::LatencyInfo() : trace_id(-1), terminated(false) { |
117 } | 117 } |
118 | 118 |
119 LatencyInfo::~LatencyInfo() { | 119 LatencyInfo::~LatencyInfo() { |
120 } | 120 } |
121 | 121 |
| 122 bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info, |
| 123 const char* referring_msg) { |
| 124 if (latency_info.size() > kMaxLatencyInfoNumber) { |
| 125 LOG(ERROR) << referring_msg << ", LatencyInfo vector size " |
| 126 << latency_info.size() << " is too big."; |
| 127 return false; |
| 128 } |
| 129 return true; |
| 130 } |
| 131 |
122 void LatencyInfo::MergeWith(const LatencyInfo& other) { | 132 void LatencyInfo::MergeWith(const LatencyInfo& other) { |
123 for (LatencyMap::const_iterator it = other.latency_components.begin(); | 133 for (LatencyMap::const_iterator it = other.latency_components.begin(); |
124 it != other.latency_components.end(); | 134 it != other.latency_components.end(); |
125 ++it) { | 135 ++it) { |
126 AddLatencyNumberWithTimestamp(it->first.first, | 136 AddLatencyNumberWithTimestamp(it->first.first, |
127 it->first.second, | 137 it->first.second, |
128 it->second.sequence_number, | 138 it->second.sequence_number, |
129 it->second.event_time, | 139 it->second.event_time, |
130 it->second.event_count, | 140 it->second.event_count, |
131 false); | 141 false); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 239 } |
230 | 240 |
231 void LatencyInfo::TraceEventType(const char* event_type) { | 241 void LatencyInfo::TraceEventType(const char* event_type) { |
232 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", | 242 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", |
233 "InputLatency", | 243 "InputLatency", |
234 TRACE_ID_DONT_MANGLE(trace_id), | 244 TRACE_ID_DONT_MANGLE(trace_id), |
235 event_type); | 245 event_type); |
236 } | 246 } |
237 | 247 |
238 } // namespace ui | 248 } // namespace ui |
OLD | NEW |