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

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

Issue 1717283003: tracing: Make ConvertableToTraceFormat move-only scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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
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 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 approximated_visible_content_area(0), 43 approximated_visible_content_area(0),
44 checkerboarded_visible_content_area(0), 44 checkerboarded_visible_content_area(0),
45 checkerboarded_no_recording_content_area(0), 45 checkerboarded_no_recording_content_area(0),
46 checkerboarded_needs_raster_content_area(0) {} 46 checkerboarded_needs_raster_content_area(0) {}
47 47
48 RenderingStats::RenderingStats(const RenderingStats& other) = default; 48 RenderingStats::RenderingStats(const RenderingStats& other) = default;
49 49
50 RenderingStats::~RenderingStats() { 50 RenderingStats::~RenderingStats() {
51 } 51 }
52 52
53 scoped_refptr<base::trace_event::ConvertableToTraceFormat> 53 scoped_ptr<base::trace_event::ConvertableToTraceFormat>
54 RenderingStats::AsTraceableData() const { 54 RenderingStats::AsTraceableData() const {
55 scoped_refptr<base::trace_event::TracedValue> record_data = 55 scoped_ptr<base::trace_event::TracedValue> record_data(
56 new base::trace_event::TracedValue(); 56 new base::trace_event::TracedValue());
57 record_data->SetInteger("frame_count", frame_count); 57 record_data->SetInteger("frame_count", frame_count);
58 record_data->SetInteger("visible_content_area", visible_content_area); 58 record_data->SetInteger("visible_content_area", visible_content_area);
59 record_data->SetInteger("approximated_visible_content_area", 59 record_data->SetInteger("approximated_visible_content_area",
60 approximated_visible_content_area); 60 approximated_visible_content_area);
61 record_data->SetInteger("checkerboarded_visible_content_area", 61 record_data->SetInteger("checkerboarded_visible_content_area",
62 checkerboarded_visible_content_area); 62 checkerboarded_visible_content_area);
63 record_data->SetInteger("checkerboarded_no_recording_content_area", 63 record_data->SetInteger("checkerboarded_no_recording_content_area",
64 checkerboarded_no_recording_content_area); 64 checkerboarded_no_recording_content_area);
65 record_data->SetInteger("checkerboarded_needs_raster_content_area", 65 record_data->SetInteger("checkerboarded_needs_raster_content_area",
66 checkerboarded_needs_raster_content_area); 66 checkerboarded_needs_raster_content_area);
67 draw_duration.AddToTracedValue("draw_duration_ms", record_data.get()); 67 draw_duration.AddToTracedValue("draw_duration_ms", record_data.get());
68 68
69 draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms", 69 draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms",
70 record_data.get()); 70 record_data.get());
71 71
72 begin_main_frame_to_commit_duration.AddToTracedValue( 72 begin_main_frame_to_commit_duration.AddToTracedValue(
73 "begin_main_frame_to_commit_duration_ms", record_data.get()); 73 "begin_main_frame_to_commit_duration_ms", record_data.get());
74 74
75 begin_main_frame_to_commit_duration_estimate.AddToTracedValue( 75 begin_main_frame_to_commit_duration_estimate.AddToTracedValue(
76 "begin_main_frame_to_commit_duration_estimate_ms", record_data.get()); 76 "begin_main_frame_to_commit_duration_estimate_ms", record_data.get());
77 77
78 commit_to_activate_duration.AddToTracedValue("commit_to_activate_duration_ms", 78 commit_to_activate_duration.AddToTracedValue("commit_to_activate_duration_ms",
79 record_data.get()); 79 record_data.get());
80 80
81 commit_to_activate_duration_estimate.AddToTracedValue( 81 commit_to_activate_duration_estimate.AddToTracedValue(
82 "commit_to_activate_duration_estimate_ms", record_data.get()); 82 "commit_to_activate_duration_estimate_ms", record_data.get());
83 return record_data; 83 return std::move(record_data);
84 } 84 }
85 85
86 void RenderingStats::Add(const RenderingStats& other) { 86 void RenderingStats::Add(const RenderingStats& other) {
87 frame_count += other.frame_count; 87 frame_count += other.frame_count;
88 visible_content_area += other.visible_content_area; 88 visible_content_area += other.visible_content_area;
89 approximated_visible_content_area += other.approximated_visible_content_area; 89 approximated_visible_content_area += other.approximated_visible_content_area;
90 checkerboarded_visible_content_area += 90 checkerboarded_visible_content_area +=
91 other.checkerboarded_visible_content_area; 91 other.checkerboarded_visible_content_area;
92 checkerboarded_no_recording_content_area += 92 checkerboarded_no_recording_content_area +=
93 other.checkerboarded_no_recording_content_area; 93 other.checkerboarded_no_recording_content_area;
94 checkerboarded_needs_raster_content_area += 94 checkerboarded_needs_raster_content_area +=
95 other.checkerboarded_needs_raster_content_area; 95 other.checkerboarded_needs_raster_content_area;
96 96
97 draw_duration.Add(other.draw_duration); 97 draw_duration.Add(other.draw_duration);
98 draw_duration_estimate.Add(other.draw_duration_estimate); 98 draw_duration_estimate.Add(other.draw_duration_estimate);
99 begin_main_frame_to_commit_duration.Add( 99 begin_main_frame_to_commit_duration.Add(
100 other.begin_main_frame_to_commit_duration); 100 other.begin_main_frame_to_commit_duration);
101 begin_main_frame_to_commit_duration_estimate.Add( 101 begin_main_frame_to_commit_duration_estimate.Add(
102 other.begin_main_frame_to_commit_duration_estimate); 102 other.begin_main_frame_to_commit_duration_estimate);
103 commit_to_activate_duration.Add(other.commit_to_activate_duration); 103 commit_to_activate_duration.Add(other.commit_to_activate_duration);
104 commit_to_activate_duration_estimate.Add( 104 commit_to_activate_duration_estimate.Add(
105 other.commit_to_activate_duration_estimate); 105 other.commit_to_activate_duration_estimate);
106 } 106 }
107 107
108 } // namespace cc 108 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698