| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/debug/rendering_stats.h" | 5 #include "cc/debug/rendering_stats.h" |
| 6 | 6 |
| 7 namespace cc { | 7 namespace cc { |
| 8 | 8 |
| 9 RenderingStats::TimeDeltaList::TimeDeltaList() { | 9 RenderingStats::TimeDeltaList::TimeDeltaList() { |
| 10 } | 10 } |
| 11 | 11 |
| 12 RenderingStats::TimeDeltaList::~TimeDeltaList() { | 12 RenderingStats::TimeDeltaList::~TimeDeltaList() { |
| 13 } | 13 } |
| 14 | 14 |
| 15 void RenderingStats::TimeDeltaList::Append(base::TimeDelta value) { | 15 void RenderingStats::TimeDeltaList::Append(base::TimeDelta value) { |
| 16 values.push_back(value); | 16 values.push_back(value); |
| 17 } | 17 } |
| 18 | 18 |
| 19 void RenderingStats::TimeDeltaList::AddToTracedValue( | 19 void RenderingStats::TimeDeltaList::AddToTracedValue( |
| 20 const char* name, | 20 const char* name, |
| 21 base::debug::TracedValue* list_value) const { | 21 base::trace_event::TracedValue* list_value) const { |
| 22 list_value->BeginArray(name); | 22 list_value->BeginArray(name); |
| 23 for (const auto& value : values) { | 23 for (const auto& value : values) { |
| 24 list_value->AppendDouble(value.InMillisecondsF()); | 24 list_value->AppendDouble(value.InMillisecondsF()); |
| 25 } | 25 } |
| 26 list_value->EndArray(); | 26 list_value->EndArray(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) { | 29 void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) { |
| 30 values.insert(values.end(), other.values.begin(), other.values.end()); | 30 values.insert(values.end(), other.values.begin(), other.values.end()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 base::TimeDelta RenderingStats::TimeDeltaList::GetLastTimeDelta() const { | 33 base::TimeDelta RenderingStats::TimeDeltaList::GetLastTimeDelta() const { |
| 34 return values.empty() ? base::TimeDelta() : values.back(); | 34 return values.empty() ? base::TimeDelta() : values.back(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 RenderingStats::RenderingStats() | 37 RenderingStats::RenderingStats() |
| 38 : frame_count(0), | 38 : frame_count(0), |
| 39 visible_content_area(0), | 39 visible_content_area(0), |
| 40 approximated_visible_content_area(0) { | 40 approximated_visible_content_area(0) { |
| 41 } | 41 } |
| 42 | 42 |
| 43 RenderingStats::~RenderingStats() { | 43 RenderingStats::~RenderingStats() { |
| 44 } | 44 } |
| 45 | 45 |
| 46 scoped_refptr<base::debug::ConvertableToTraceFormat> | 46 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 47 RenderingStats::AsTraceableData() const { | 47 RenderingStats::AsTraceableData() const { |
| 48 scoped_refptr<base::debug::TracedValue> record_data = | 48 scoped_refptr<base::trace_event::TracedValue> record_data = |
| 49 new base::debug::TracedValue(); | 49 new base::trace_event::TracedValue(); |
| 50 record_data->SetInteger("frame_count", frame_count); | 50 record_data->SetInteger("frame_count", frame_count); |
| 51 record_data->SetInteger("visible_content_area", visible_content_area); | 51 record_data->SetInteger("visible_content_area", visible_content_area); |
| 52 record_data->SetInteger("approximated_visible_content_area", | 52 record_data->SetInteger("approximated_visible_content_area", |
| 53 approximated_visible_content_area); | 53 approximated_visible_content_area); |
| 54 draw_duration.AddToTracedValue("draw_duration_ms", record_data.get()); | 54 draw_duration.AddToTracedValue("draw_duration_ms", record_data.get()); |
| 55 | 55 |
| 56 draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms", | 56 draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms", |
| 57 record_data.get()); | 57 record_data.get()); |
| 58 | 58 |
| 59 begin_main_frame_to_commit_duration.AddToTracedValue( | 59 begin_main_frame_to_commit_duration.AddToTracedValue( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 80 begin_main_frame_to_commit_duration.Add( | 80 begin_main_frame_to_commit_duration.Add( |
| 81 other.begin_main_frame_to_commit_duration); | 81 other.begin_main_frame_to_commit_duration); |
| 82 begin_main_frame_to_commit_duration_estimate.Add( | 82 begin_main_frame_to_commit_duration_estimate.Add( |
| 83 other.begin_main_frame_to_commit_duration_estimate); | 83 other.begin_main_frame_to_commit_duration_estimate); |
| 84 commit_to_activate_duration.Add(other.commit_to_activate_duration); | 84 commit_to_activate_duration.Add(other.commit_to_activate_duration); |
| 85 commit_to_activate_duration_estimate.Add( | 85 commit_to_activate_duration_estimate.Add( |
| 86 other.commit_to_activate_duration_estimate); | 86 other.commit_to_activate_duration_estimate); |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace cc | 89 } // namespace cc |
| OLD | NEW |