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 "ui/events/latency_info.h" | 5 #include "ui/events/latency_info.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 LatencyInfoTracedValue::FromValue(scoped_ptr<base::Value> value) { | 101 LatencyInfoTracedValue::FromValue(scoped_ptr<base::Value> value) { |
102 return scoped_refptr<base::trace_event::ConvertableToTraceFormat>( | 102 return scoped_refptr<base::trace_event::ConvertableToTraceFormat>( |
103 new LatencyInfoTracedValue(value.release())); | 103 new LatencyInfoTracedValue(value.release())); |
104 } | 104 } |
105 | 105 |
106 LatencyInfoTracedValue::~LatencyInfoTracedValue() { | 106 LatencyInfoTracedValue::~LatencyInfoTracedValue() { |
107 } | 107 } |
108 | 108 |
109 void LatencyInfoTracedValue::AppendAsTraceFormat(std::string* out) const { | 109 void LatencyInfoTracedValue::AppendAsTraceFormat(std::string* out) const { |
110 std::string tmp; | 110 std::string tmp; |
111 base::JSONWriter::Write(value_.get(), &tmp); | 111 base::JSONWriter::Write(*value_, &tmp); |
112 *out += tmp; | 112 *out += tmp; |
113 } | 113 } |
114 | 114 |
115 LatencyInfoTracedValue::LatencyInfoTracedValue(base::Value* value) | 115 LatencyInfoTracedValue::LatencyInfoTracedValue(base::Value* value) |
116 : value_(value) { | 116 : value_(value) { |
117 } | 117 } |
118 | 118 |
119 // Converts latencyinfo into format that can be dumped into trace buffer. | 119 // Converts latencyinfo into format that can be dumped into trace buffer. |
120 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsTraceableData( | 120 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsTraceableData( |
121 const ui::LatencyInfo& latency) { | 121 const ui::LatencyInfo& latency) { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 it++; | 366 it++; |
367 } | 367 } |
368 } | 368 } |
369 } | 369 } |
370 | 370 |
371 void LatencyInfo::Clear() { | 371 void LatencyInfo::Clear() { |
372 latency_components.clear(); | 372 latency_components.clear(); |
373 } | 373 } |
374 | 374 |
375 } // namespace ui | 375 } // namespace ui |
OLD | NEW |