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

Side by Side Diff: cc/debug/rendering_stats.cc

Issue 421183003: Revert of Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/debug/rendering_stats.h ('k') | cc/debug/rendering_stats_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 scoped_ptr<base::ListValue>
20 base::debug::TracedValue* list_value) const { 20 RenderingStats::TimeDeltaList::AsListValueInMilliseconds() const {
21 scoped_ptr<base::ListValue> list_value(new base::ListValue);
21 std::list<base::TimeDelta>::const_iterator iter; 22 std::list<base::TimeDelta>::const_iterator iter;
22 for (iter = values.begin(); iter != values.end(); ++iter) { 23 for (iter = values.begin(); iter != values.end(); ++iter) {
23 list_value->AppendDouble(iter->InMillisecondsF()); 24 list_value->AppendDouble(iter->InMillisecondsF());
24 } 25 }
26 return list_value.Pass();
25 } 27 }
26 28
27 void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) { 29 void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) {
28 values.insert(values.end(), other.values.begin(), other.values.end()); 30 values.insert(values.end(), other.values.begin(), other.values.end());
29 } 31 }
30 32
31 RenderingStats::MainThreadRenderingStats::MainThreadRenderingStats() 33 RenderingStats::MainThreadRenderingStats::MainThreadRenderingStats()
32 : frame_count(0), painted_pixel_count(0), recorded_pixel_count(0) { 34 : frame_count(0), painted_pixel_count(0), recorded_pixel_count(0) {
33 } 35 }
34 36
35 RenderingStats::MainThreadRenderingStats::~MainThreadRenderingStats() { 37 RenderingStats::MainThreadRenderingStats::~MainThreadRenderingStats() {
36 } 38 }
37 39
38 scoped_refptr<base::debug::ConvertableToTraceFormat> 40 scoped_refptr<base::debug::ConvertableToTraceFormat>
39 RenderingStats::MainThreadRenderingStats::AsTraceableData() const { 41 RenderingStats::MainThreadRenderingStats::AsTraceableData() const {
40 scoped_refptr<base::debug::TracedValue> record_data = 42 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
41 new base::debug::TracedValue();
42 record_data->SetInteger("frame_count", frame_count); 43 record_data->SetInteger("frame_count", frame_count);
43 record_data->SetDouble("paint_time", paint_time.InSecondsF()); 44 record_data->SetDouble("paint_time", paint_time.InSecondsF());
44 record_data->SetInteger("painted_pixel_count", painted_pixel_count); 45 record_data->SetInteger("painted_pixel_count", painted_pixel_count);
45 record_data->SetDouble("record_time", record_time.InSecondsF()); 46 record_data->SetDouble("record_time", record_time.InSecondsF());
46 record_data->SetInteger("recorded_pixel_count", recorded_pixel_count); 47 record_data->SetInteger("recorded_pixel_count", recorded_pixel_count);
47 return record_data; 48 return TracedValue::FromValue(record_data.release());
48 } 49 }
49 50
50 void RenderingStats::MainThreadRenderingStats::Add( 51 void RenderingStats::MainThreadRenderingStats::Add(
51 const MainThreadRenderingStats& other) { 52 const MainThreadRenderingStats& other) {
52 frame_count += other.frame_count; 53 frame_count += other.frame_count;
53 paint_time += other.paint_time; 54 paint_time += other.paint_time;
54 painted_pixel_count += other.painted_pixel_count; 55 painted_pixel_count += other.painted_pixel_count;
55 record_time += other.record_time; 56 record_time += other.record_time;
56 recorded_pixel_count += other.recorded_pixel_count; 57 recorded_pixel_count += other.recorded_pixel_count;
57 } 58 }
58 59
59 RenderingStats::ImplThreadRenderingStats::ImplThreadRenderingStats() 60 RenderingStats::ImplThreadRenderingStats::ImplThreadRenderingStats()
60 : frame_count(0), 61 : frame_count(0),
61 rasterized_pixel_count(0), 62 rasterized_pixel_count(0),
62 visible_content_area(0), 63 visible_content_area(0),
63 approximated_visible_content_area(0) { 64 approximated_visible_content_area(0) {
64 } 65 }
65 66
66 RenderingStats::ImplThreadRenderingStats::~ImplThreadRenderingStats() { 67 RenderingStats::ImplThreadRenderingStats::~ImplThreadRenderingStats() {
67 } 68 }
68 69
69 scoped_refptr<base::debug::ConvertableToTraceFormat> 70 scoped_refptr<base::debug::ConvertableToTraceFormat>
70 RenderingStats::ImplThreadRenderingStats::AsTraceableData() const { 71 RenderingStats::ImplThreadRenderingStats::AsTraceableData() const {
71 scoped_refptr<base::debug::TracedValue> record_data = 72 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
72 new base::debug::TracedValue();
73 record_data->SetInteger("frame_count", frame_count); 73 record_data->SetInteger("frame_count", frame_count);
74 record_data->SetDouble("rasterize_time", rasterize_time.InSecondsF()); 74 record_data->SetDouble("rasterize_time", rasterize_time.InSecondsF());
75 record_data->SetInteger("rasterized_pixel_count", rasterized_pixel_count); 75 record_data->SetInteger("rasterized_pixel_count", rasterized_pixel_count);
76 record_data->SetInteger("visible_content_area", visible_content_area); 76 record_data->SetInteger("visible_content_area", visible_content_area);
77 record_data->SetInteger("approximated_visible_content_area", 77 record_data->SetInteger("approximated_visible_content_area",
78 approximated_visible_content_area); 78 approximated_visible_content_area);
79 record_data->BeginArray("draw_duration_ms"); 79 record_data->Set("draw_duration_ms",
80 draw_duration.AddToTracedValue(record_data.get()); 80 draw_duration.AsListValueInMilliseconds().release());
81 record_data->EndArray(); 81 record_data->Set(
82 82 "draw_duration_estimate_ms",
83 record_data->BeginArray("draw_duration_estimate_ms"); 83 draw_duration_estimate.AsListValueInMilliseconds().release());
84 draw_duration_estimate.AddToTracedValue(record_data.get()); 84 record_data->Set(
85 record_data->EndArray(); 85 "begin_main_frame_to_commit_duration_ms",
86 86 begin_main_frame_to_commit_duration.AsListValueInMilliseconds()
87 record_data->BeginArray("begin_main_frame_to_commit_duration_ms"); 87 .release());
88 begin_main_frame_to_commit_duration.AddToTracedValue(record_data.get()); 88 record_data->Set(
89 record_data->EndArray(); 89 "begin_main_frame_to_commit_duration_estimate_ms",
90 90 begin_main_frame_to_commit_duration_estimate.AsListValueInMilliseconds()
91 record_data->BeginArray("begin_main_frame_to_commit_duration_estimate_ms"); 91 .release());
92 begin_main_frame_to_commit_duration_estimate.AddToTracedValue( 92 record_data->Set(
93 record_data.get()); 93 "commit_to_activate_duration_ms",
94 record_data->EndArray(); 94 commit_to_activate_duration.AsListValueInMilliseconds().release());
95 95 record_data->Set(
96 record_data->BeginArray("commit_to_activate_duration_ms"); 96 "commit_to_activate_duration_estimate_ms",
97 commit_to_activate_duration.AddToTracedValue(record_data.get()); 97 commit_to_activate_duration_estimate.AsListValueInMilliseconds()
98 record_data->EndArray(); 98 .release());
99 99 return TracedValue::FromValue(record_data.release());
100 record_data->BeginArray("commit_to_activate_duration_estimate_ms");
101 commit_to_activate_duration_estimate.AddToTracedValue(record_data.get());
102 record_data->EndArray();
103 return record_data;
104 } 100 }
105 101
106 void RenderingStats::ImplThreadRenderingStats::Add( 102 void RenderingStats::ImplThreadRenderingStats::Add(
107 const ImplThreadRenderingStats& other) { 103 const ImplThreadRenderingStats& other) {
108 frame_count += other.frame_count; 104 frame_count += other.frame_count;
109 rasterize_time += other.rasterize_time; 105 rasterize_time += other.rasterize_time;
110 analysis_time += other.analysis_time; 106 analysis_time += other.analysis_time;
111 rasterized_pixel_count += other.rasterized_pixel_count; 107 rasterized_pixel_count += other.rasterized_pixel_count;
112 visible_content_area += other.visible_content_area; 108 visible_content_area += other.visible_content_area;
113 approximated_visible_content_area += other.approximated_visible_content_area; 109 approximated_visible_content_area += other.approximated_visible_content_area;
114 110
115 draw_duration.Add(other.draw_duration); 111 draw_duration.Add(other.draw_duration);
116 draw_duration_estimate.Add(other.draw_duration_estimate); 112 draw_duration_estimate.Add(other.draw_duration_estimate);
117 begin_main_frame_to_commit_duration.Add( 113 begin_main_frame_to_commit_duration.Add(
118 other.begin_main_frame_to_commit_duration); 114 other.begin_main_frame_to_commit_duration);
119 begin_main_frame_to_commit_duration_estimate.Add( 115 begin_main_frame_to_commit_duration_estimate.Add(
120 other.begin_main_frame_to_commit_duration_estimate); 116 other.begin_main_frame_to_commit_duration_estimate);
121 commit_to_activate_duration.Add(other.commit_to_activate_duration); 117 commit_to_activate_duration.Add(other.commit_to_activate_duration);
122 commit_to_activate_duration_estimate.Add( 118 commit_to_activate_duration_estimate.Add(
123 other.commit_to_activate_duration_estimate); 119 other.commit_to_activate_duration_estimate);
124 } 120 }
125 121
126 void RenderingStats::Add(const RenderingStats& other) { 122 void RenderingStats::Add(const RenderingStats& other) {
127 main_stats.Add(other.main_stats); 123 main_stats.Add(other.main_stats);
128 impl_stats.Add(other.impl_stats); 124 impl_stats.Add(other.impl_stats);
129 } 125 }
130 126
131 } // namespace cc 127 } // namespace cc
OLDNEW
« 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