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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 for (ui::LatencyInfo::LatencyMap::const_iterator it = | 110 for (ui::LatencyInfo::LatencyMap::const_iterator it = |
111 latency.latency_components.begin(); | 111 latency.latency_components.begin(); |
112 it != latency.latency_components.end(); ++it) { | 112 it != latency.latency_components.end(); ++it) { |
113 base::DictionaryValue* component_info = new base::DictionaryValue(); | 113 base::DictionaryValue* component_info = new base::DictionaryValue(); |
114 component_info->SetDouble("comp_id", it->first.second); | 114 component_info->SetDouble("comp_id", it->first.second); |
115 component_info->SetDouble("time", it->second.event_time.ToInternalValue()); | 115 component_info->SetDouble("time", it->second.event_time.ToInternalValue()); |
116 component_info->SetDouble("count", it->second.event_count); | 116 component_info->SetDouble("count", it->second.event_count); |
117 record_data->Set(GetComponentName(it->first.first), component_info); | 117 record_data->Set(GetComponentName(it->first.first), component_info); |
118 } | 118 } |
119 record_data->SetDouble("trace_id", latency.trace_id); | 119 record_data->SetDouble("trace_id", latency.trace_id); |
120 | |
121 scoped_ptr<base::ListValue> coordinates(new base::ListValue()); | |
122 for (size_t i = 0; i < latency.coordinates.size(); i++) { | |
123 scoped_ptr<base::DictionaryValue> coordinate_pair( | |
Sami
2014/09/05 17:26:02
Indent++
| |
124 new base::DictionaryValue()); | |
125 coordinate_pair->SetDouble("x", latency.coordinates[i].x()); | |
126 coordinate_pair->SetDouble("y", latency.coordinates[i].y()); | |
127 coordinates->Append(coordinate_pair.release()); | |
128 } | |
129 record_data->Set("coordinates", coordinates.release()); | |
120 return LatencyInfoTracedValue::FromValue(record_data.PassAs<base::Value>()); | 130 return LatencyInfoTracedValue::FromValue(record_data.PassAs<base::Value>()); |
121 } | 131 } |
122 | 132 |
123 } // namespace | 133 } // namespace |
124 | 134 |
125 namespace ui { | 135 namespace ui { |
126 | 136 |
127 LatencyInfo::LatencyInfo() : trace_id(-1), terminated(false) { | 137 LatencyInfo::LatencyInfo() : trace_id(-1), terminated(false) { |
128 } | 138 } |
129 | 139 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 } | 303 } |
294 | 304 |
295 void LatencyInfo::TraceEventType(const char* event_type) { | 305 void LatencyInfo::TraceEventType(const char* event_type) { |
296 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", | 306 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", |
297 "InputLatency", | 307 "InputLatency", |
298 TRACE_ID_DONT_MANGLE(trace_id), | 308 TRACE_ID_DONT_MANGLE(trace_id), |
299 event_type); | 309 event_type); |
300 } | 310 } |
301 | 311 |
302 } // namespace ui | 312 } // namespace ui |
OLD | NEW |