diff options
author | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-01 13:10:38 +0000 |
---|---|---|
committer | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-01 13:10:38 +0000 |
commit | d12aa932d3555eda2c011022e94df82023fa191d (patch) | |
tree | f1f9244b6beccfd2797d74fc1d1acea896d2a601 /cc/debug/rendering_stats.cc | |
parent | 59d75c8166ae16a7879c11595fbde2ab1cffad3b (diff) | |
download | chromium_src-d12aa932d3555eda2c011022e94df82023fa191d.zip chromium_src-d12aa932d3555eda2c011022e94df82023fa191d.tar.gz chromium_src-d12aa932d3555eda2c011022e94df82023fa191d.tar.bz2 |
Add builders for tracing event's structural arguments
The new classes allow building JSON-like structural arguments. Current implementation uses base::Value as backing store but that can be replaced in the future with something more efficient without changing client code.
All clients of cc/debug/traced_value.h should eventually switch to use the new builders.
BUG=361045
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=286849
R=alph@chromium.org, dsinclair@chromium.org, nduca@chromium.org, willchan@chromium.org
Review URL: https://codereview.chromium.org/380763002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286984 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/debug/rendering_stats.cc')
-rw-r--r-- | cc/debug/rendering_stats.cc | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/cc/debug/rendering_stats.cc b/cc/debug/rendering_stats.cc index 47bc7c7..b5989fc 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( |