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

Unified Diff: cc/debug/rendering_stats.cc

Issue 380763002: Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed memory leak found by Linux ASAN Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/debug/rendering_stats.h ('k') | cc/debug/rendering_stats_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/debug/rendering_stats.cc
diff --git a/cc/debug/rendering_stats.cc b/cc/debug/rendering_stats.cc
index 47bc7c7d1556d3e47f352e99af3a896336472b76..b5989fc121285dc49483498ab3060f84ae9cc3d9 100644
--- a/cc/debug/rendering_stats.cc
+++ b/cc/debug/rendering_stats.cc
@@ -16,14 +16,12 @@ void RenderingStats::TimeDeltaList::Append(base::TimeDelta value) {
values.push_back(value);
}
-scoped_ptr<base::ListValue>
-RenderingStats::TimeDeltaList::AsListValueInMilliseconds() const {
- scoped_ptr<base::ListValue> list_value(new base::ListValue);
+void RenderingStats::TimeDeltaList::AddToTracedValue(
+ base::debug::TracedValue* list_value) const {
std::list<base::TimeDelta>::const_iterator iter;
for (iter = values.begin(); iter != values.end(); ++iter) {
list_value->AppendDouble(iter->InMillisecondsF());
}
- return list_value.Pass();
}
void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) {
@@ -39,13 +37,14 @@ RenderingStats::MainThreadRenderingStats::~MainThreadRenderingStats() {
scoped_refptr<base::debug::ConvertableToTraceFormat>
RenderingStats::MainThreadRenderingStats::AsTraceableData() const {
- scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
+ scoped_refptr<base::debug::TracedValue> record_data =
+ new base::debug::TracedValue();
record_data->SetInteger("frame_count", frame_count);
record_data->SetDouble("paint_time", paint_time.InSecondsF());
record_data->SetInteger("painted_pixel_count", painted_pixel_count);
record_data->SetDouble("record_time", record_time.InSecondsF());
record_data->SetInteger("recorded_pixel_count", recorded_pixel_count);
- return TracedValue::FromValue(record_data.release());
+ return record_data;
}
void RenderingStats::MainThreadRenderingStats::Add(
@@ -69,34 +68,39 @@ RenderingStats::ImplThreadRenderingStats::~ImplThreadRenderingStats() {
scoped_refptr<base::debug::ConvertableToTraceFormat>
RenderingStats::ImplThreadRenderingStats::AsTraceableData() const {
- scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
+ scoped_refptr<base::debug::TracedValue> record_data =
+ new base::debug::TracedValue();
record_data->SetInteger("frame_count", frame_count);
record_data->SetDouble("rasterize_time", rasterize_time.InSecondsF());
record_data->SetInteger("rasterized_pixel_count", rasterized_pixel_count);
record_data->SetInteger("visible_content_area", visible_content_area);
record_data->SetInteger("approximated_visible_content_area",
approximated_visible_content_area);
- record_data->Set("draw_duration_ms",
- draw_duration.AsListValueInMilliseconds().release());
- record_data->Set(
- "draw_duration_estimate_ms",
- draw_duration_estimate.AsListValueInMilliseconds().release());
- record_data->Set(
- "begin_main_frame_to_commit_duration_ms",
- begin_main_frame_to_commit_duration.AsListValueInMilliseconds()
- .release());
- record_data->Set(
- "begin_main_frame_to_commit_duration_estimate_ms",
- begin_main_frame_to_commit_duration_estimate.AsListValueInMilliseconds()
- .release());
- record_data->Set(
- "commit_to_activate_duration_ms",
- commit_to_activate_duration.AsListValueInMilliseconds().release());
- record_data->Set(
- "commit_to_activate_duration_estimate_ms",
- commit_to_activate_duration_estimate.AsListValueInMilliseconds()
- .release());
- return TracedValue::FromValue(record_data.release());
+ record_data->BeginArray("draw_duration_ms");
+ draw_duration.AddToTracedValue(record_data.get());
+ record_data->EndArray();
+
+ record_data->BeginArray("draw_duration_estimate_ms");
+ draw_duration_estimate.AddToTracedValue(record_data.get());
+ record_data->EndArray();
+
+ record_data->BeginArray("begin_main_frame_to_commit_duration_ms");
+ begin_main_frame_to_commit_duration.AddToTracedValue(record_data.get());
+ record_data->EndArray();
+
+ record_data->BeginArray("begin_main_frame_to_commit_duration_estimate_ms");
+ begin_main_frame_to_commit_duration_estimate.AddToTracedValue(
+ record_data.get());
+ record_data->EndArray();
+
+ record_data->BeginArray("commit_to_activate_duration_ms");
+ commit_to_activate_duration.AddToTracedValue(record_data.get());
+ record_data->EndArray();
+
+ record_data->BeginArray("commit_to_activate_duration_estimate_ms");
+ commit_to_activate_duration_estimate.AddToTracedValue(record_data.get());
+ record_data->EndArray();
+ return record_data;
}
void RenderingStats::ImplThreadRenderingStats::Add(
« no previous file with comments | « cc/debug/rendering_stats.h ('k') | cc/debug/rendering_stats_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698