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

Side by Side Diff: ui/events/latency_info.cc

Issue 660173002: Type conversion fixes, ui/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « ui/events/keycodes/keyboard_code_conversion.cc ('k') | ui/events/test/event_generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 // Converts latencyinfo into format that can be dumped into trace buffer. 109 // Converts latencyinfo into format that can be dumped into trace buffer.
110 scoped_refptr<base::debug::ConvertableToTraceFormat> AsTraceableData( 110 scoped_refptr<base::debug::ConvertableToTraceFormat> AsTraceableData(
111 const ui::LatencyInfo& latency) { 111 const ui::LatencyInfo& latency) {
112 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); 112 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
113 for (ui::LatencyInfo::LatencyMap::const_iterator it = 113 for (ui::LatencyInfo::LatencyMap::const_iterator it =
114 latency.latency_components.begin(); 114 latency.latency_components.begin();
115 it != latency.latency_components.end(); ++it) { 115 it != latency.latency_components.end(); ++it) {
116 base::DictionaryValue* component_info = new base::DictionaryValue(); 116 base::DictionaryValue* component_info = new base::DictionaryValue();
117 component_info->SetDouble("comp_id", it->first.second); 117 component_info->SetDouble("comp_id", static_cast<double>(it->first.second));
118 component_info->SetDouble("time", it->second.event_time.ToInternalValue()); 118 component_info->SetDouble(
119 "time", static_cast<double>(it->second.event_time.ToInternalValue()));
119 component_info->SetDouble("count", it->second.event_count); 120 component_info->SetDouble("count", it->second.event_count);
120 record_data->Set(GetComponentName(it->first.first), component_info); 121 record_data->Set(GetComponentName(it->first.first), component_info);
121 } 122 }
122 record_data->SetDouble("trace_id", latency.trace_id); 123 record_data->SetDouble("trace_id", static_cast<double>(latency.trace_id));
123 124
124 scoped_ptr<base::ListValue> coordinates(new base::ListValue()); 125 scoped_ptr<base::ListValue> coordinates(new base::ListValue());
125 for (size_t i = 0; i < latency.input_coordinates_size; i++) { 126 for (size_t i = 0; i < latency.input_coordinates_size; i++) {
126 scoped_ptr<base::DictionaryValue> coordinate_pair( 127 scoped_ptr<base::DictionaryValue> coordinate_pair(
127 new base::DictionaryValue()); 128 new base::DictionaryValue());
128 coordinate_pair->SetDouble("x", latency.input_coordinates[i].x); 129 coordinate_pair->SetDouble("x", latency.input_coordinates[i].x);
129 coordinate_pair->SetDouble("y", latency.input_coordinates[i].y); 130 coordinate_pair->SetDouble("y", latency.input_coordinates[i].y);
130 coordinates->Append(coordinate_pair.release()); 131 coordinates->Append(coordinate_pair.release());
131 } 132 }
132 record_data->Set("coordinates", coordinates.release()); 133 record_data->Set("coordinates", coordinates.release());
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } 322 }
322 323
323 void LatencyInfo::TraceEventType(const char* event_type) { 324 void LatencyInfo::TraceEventType(const char* event_type) {
324 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", 325 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark",
325 "InputLatency", 326 "InputLatency",
326 TRACE_ID_DONT_MANGLE(trace_id), 327 TRACE_ID_DONT_MANGLE(trace_id),
327 event_type); 328 event_type);
328 } 329 }
329 330
330 } // namespace ui 331 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/keycodes/keyboard_code_conversion.cc ('k') | ui/events/test/event_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698