| 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 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 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 checkerboarded_visible_content_area(0) { |
| 41 } | 42 } |
| 42 | 43 |
| 43 RenderingStats::~RenderingStats() { | 44 RenderingStats::~RenderingStats() { |
| 44 } | 45 } |
| 45 | 46 |
| 46 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 47 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 47 RenderingStats::AsTraceableData() const { | 48 RenderingStats::AsTraceableData() const { |
| 48 scoped_refptr<base::trace_event::TracedValue> record_data = | 49 scoped_refptr<base::trace_event::TracedValue> record_data = |
| 49 new base::trace_event::TracedValue(); | 50 new base::trace_event::TracedValue(); |
| 50 record_data->SetInteger("frame_count", frame_count); | 51 record_data->SetInteger("frame_count", frame_count); |
| 51 record_data->SetInteger("visible_content_area", visible_content_area); | 52 record_data->SetInteger("visible_content_area", visible_content_area); |
| 52 record_data->SetInteger("approximated_visible_content_area", | 53 record_data->SetInteger("approximated_visible_content_area", |
| 53 approximated_visible_content_area); | 54 approximated_visible_content_area); |
| 55 record_data->SetInteger("checkerboarded_visible_content_area", |
| 56 checkerboarded_visible_content_area); |
| 54 draw_duration.AddToTracedValue("draw_duration_ms", record_data.get()); | 57 draw_duration.AddToTracedValue("draw_duration_ms", record_data.get()); |
| 55 | 58 |
| 56 draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms", | 59 draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms", |
| 57 record_data.get()); | 60 record_data.get()); |
| 58 | 61 |
| 59 begin_main_frame_to_commit_duration.AddToTracedValue( | 62 begin_main_frame_to_commit_duration.AddToTracedValue( |
| 60 "begin_main_frame_to_commit_duration_ms", record_data.get()); | 63 "begin_main_frame_to_commit_duration_ms", record_data.get()); |
| 61 | 64 |
| 62 begin_main_frame_to_commit_duration_estimate.AddToTracedValue( | 65 begin_main_frame_to_commit_duration_estimate.AddToTracedValue( |
| 63 "begin_main_frame_to_commit_duration_estimate_ms", record_data.get()); | 66 "begin_main_frame_to_commit_duration_estimate_ms", record_data.get()); |
| 64 | 67 |
| 65 commit_to_activate_duration.AddToTracedValue("commit_to_activate_duration_ms", | 68 commit_to_activate_duration.AddToTracedValue("commit_to_activate_duration_ms", |
| 66 record_data.get()); | 69 record_data.get()); |
| 67 | 70 |
| 68 commit_to_activate_duration_estimate.AddToTracedValue( | 71 commit_to_activate_duration_estimate.AddToTracedValue( |
| 69 "commit_to_activate_duration_estimate_ms", record_data.get()); | 72 "commit_to_activate_duration_estimate_ms", record_data.get()); |
| 70 return record_data; | 73 return record_data; |
| 71 } | 74 } |
| 72 | 75 |
| 73 void RenderingStats::Add(const RenderingStats& other) { | 76 void RenderingStats::Add(const RenderingStats& other) { |
| 74 frame_count += other.frame_count; | 77 frame_count += other.frame_count; |
| 75 visible_content_area += other.visible_content_area; | 78 visible_content_area += other.visible_content_area; |
| 76 approximated_visible_content_area += other.approximated_visible_content_area; | 79 approximated_visible_content_area += other.approximated_visible_content_area; |
| 80 checkerboarded_visible_content_area += |
| 81 other.checkerboarded_visible_content_area; |
| 77 | 82 |
| 78 draw_duration.Add(other.draw_duration); | 83 draw_duration.Add(other.draw_duration); |
| 79 draw_duration_estimate.Add(other.draw_duration_estimate); | 84 draw_duration_estimate.Add(other.draw_duration_estimate); |
| 80 begin_main_frame_to_commit_duration.Add( | 85 begin_main_frame_to_commit_duration.Add( |
| 81 other.begin_main_frame_to_commit_duration); | 86 other.begin_main_frame_to_commit_duration); |
| 82 begin_main_frame_to_commit_duration_estimate.Add( | 87 begin_main_frame_to_commit_duration_estimate.Add( |
| 83 other.begin_main_frame_to_commit_duration_estimate); | 88 other.begin_main_frame_to_commit_duration_estimate); |
| 84 commit_to_activate_duration.Add(other.commit_to_activate_duration); | 89 commit_to_activate_duration.Add(other.commit_to_activate_duration); |
| 85 commit_to_activate_duration_estimate.Add( | 90 commit_to_activate_duration_estimate.Add( |
| 86 other.commit_to_activate_duration_estimate); | 91 other.commit_to_activate_duration_estimate); |
| 87 } | 92 } |
| 88 | 93 |
| 89 } // namespace cc | 94 } // namespace cc |
| OLD | NEW |