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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 latency_components.clear(); | 241 latency_components.clear(); |
242 } | 242 } |
243 | 243 |
244 void LatencyInfo::TraceEventType(const char* event_type) { | 244 void LatencyInfo::TraceEventType(const char* event_type) { |
245 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", | 245 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", |
246 "InputLatency", | 246 "InputLatency", |
247 TRACE_ID_DONT_MANGLE(trace_id), | 247 TRACE_ID_DONT_MANGLE(trace_id), |
248 event_type); | 248 event_type); |
249 } | 249 } |
250 | 250 |
251 void LatencyInfo::FixMissingComponentIds(int64 component_id) { | |
252 LatencyMap::iterator lc = latency_components.begin(); | |
253 while (lc != latency_components.end()) { | |
254 LatencyComponentType component_type = lc->first.first; | |
255 if (component_type == WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT) { | |
256 // If the component's ID is 0, patch it with the | |
257 // correct value. | |
258 if (lc->first.second == 0) { | |
259 // Generate a new component entry | |
260 LatencyMap::key_type key = std::make_pair(component_type, component_id); | |
261 latency_components[key] = lc->second; | |
262 | |
263 // Remove the old entry | |
264 LatencyMap::iterator eraseIter = lc; | |
265 ++lc; | |
266 latency_components.erase(eraseIter); | |
jbauman
2014/01/17 00:02:29
how about "latency_components.erase(lc++);" instea
| |
267 | |
268 continue; | |
269 } | |
270 } | |
271 | |
272 ++lc; | |
273 } | |
274 } | |
275 | |
251 } // namespace ui | 276 } // namespace ui |
OLD | NEW |