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

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: . Created 4 years, 10 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 auto record_data = make_scoped_ptr(new base::trace_event::TracedValue);
56 new base::trace_event::TracedValue();
57 record_data->SetInteger("frame_count", frame_count); 56 record_data->SetInteger("frame_count", frame_count);
58 record_data->SetInteger("visible_content_area", visible_content_area); 57 record_data->SetInteger("visible_content_area", visible_content_area);
59 record_data->SetInteger("approximated_visible_content_area", 58 record_data->SetInteger("approximated_visible_content_area",
60 approximated_visible_content_area); 59 approximated_visible_content_area);
61 record_data->SetInteger("checkerboarded_visible_content_area", 60 record_data->SetInteger("checkerboarded_visible_content_area",
62 checkerboarded_visible_content_area); 61 checkerboarded_visible_content_area);
63 record_data->SetInteger("checkerboarded_no_recording_content_area", 62 record_data->SetInteger("checkerboarded_no_recording_content_area",
64 checkerboarded_no_recording_content_area); 63 checkerboarded_no_recording_content_area);
65 record_data->SetInteger("checkerboarded_needs_raster_content_area", 64 record_data->SetInteger("checkerboarded_needs_raster_content_area",
66 checkerboarded_needs_raster_content_area); 65 checkerboarded_needs_raster_content_area);
67 draw_duration.AddToTracedValue("draw_duration_ms", record_data.get()); 66 draw_duration.AddToTracedValue("draw_duration_ms", record_data.get());
68 67
69 draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms", 68 draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms",
70 record_data.get()); 69 record_data.get());
71 70
72 begin_main_frame_to_commit_duration.AddToTracedValue( 71 begin_main_frame_to_commit_duration.AddToTracedValue(
73 "begin_main_frame_to_commit_duration_ms", record_data.get()); 72 "begin_main_frame_to_commit_duration_ms", record_data.get());
74 73
75 begin_main_frame_to_commit_duration_estimate.AddToTracedValue( 74 begin_main_frame_to_commit_duration_estimate.AddToTracedValue(
76 "begin_main_frame_to_commit_duration_estimate_ms", record_data.get()); 75 "begin_main_frame_to_commit_duration_estimate_ms", record_data.get());
77 76
78 commit_to_activate_duration.AddToTracedValue("commit_to_activate_duration_ms", 77 commit_to_activate_duration.AddToTracedValue("commit_to_activate_duration_ms",
79 record_data.get()); 78 record_data.get());
80 79
81 commit_to_activate_duration_estimate.AddToTracedValue( 80 commit_to_activate_duration_estimate.AddToTracedValue(
82 "commit_to_activate_duration_estimate_ms", record_data.get()); 81 "commit_to_activate_duration_estimate_ms", record_data.get());
83 return record_data; 82 return std::move(record_data);
84 } 83 }
85 84
86 void RenderingStats::Add(const RenderingStats& other) { 85 void RenderingStats::Add(const RenderingStats& other) {
87 frame_count += other.frame_count; 86 frame_count += other.frame_count;
88 visible_content_area += other.visible_content_area; 87 visible_content_area += other.visible_content_area;
89 approximated_visible_content_area += other.approximated_visible_content_area; 88 approximated_visible_content_area += other.approximated_visible_content_area;
90 checkerboarded_visible_content_area += 89 checkerboarded_visible_content_area +=
91 other.checkerboarded_visible_content_area; 90 other.checkerboarded_visible_content_area;
92 checkerboarded_no_recording_content_area += 91 checkerboarded_no_recording_content_area +=
93 other.checkerboarded_no_recording_content_area; 92 other.checkerboarded_no_recording_content_area;
94 checkerboarded_needs_raster_content_area += 93 checkerboarded_needs_raster_content_area +=
95 other.checkerboarded_needs_raster_content_area; 94 other.checkerboarded_needs_raster_content_area;
96 95
97 draw_duration.Add(other.draw_duration); 96 draw_duration.Add(other.draw_duration);
98 draw_duration_estimate.Add(other.draw_duration_estimate); 97 draw_duration_estimate.Add(other.draw_duration_estimate);
99 begin_main_frame_to_commit_duration.Add( 98 begin_main_frame_to_commit_duration.Add(
100 other.begin_main_frame_to_commit_duration); 99 other.begin_main_frame_to_commit_duration);
101 begin_main_frame_to_commit_duration_estimate.Add( 100 begin_main_frame_to_commit_duration_estimate.Add(
102 other.begin_main_frame_to_commit_duration_estimate); 101 other.begin_main_frame_to_commit_duration_estimate);
103 commit_to_activate_duration.Add(other.commit_to_activate_duration); 102 commit_to_activate_duration.Add(other.commit_to_activate_duration);
104 commit_to_activate_duration_estimate.Add( 103 commit_to_activate_duration_estimate.Add(
105 other.commit_to_activate_duration_estimate); 104 other.commit_to_activate_duration_estimate);
106 } 105 }
107 106
108 } // namespace cc 107 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698