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

Unified Diff: cc/debug/rendering_stats.cc

Issue 1531403002: Revert "Delete CC." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/debug/rendering_stats.h ('k') | cc/debug/rendering_stats_instrumentation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/debug/rendering_stats.cc
diff --git a/cc/debug/rendering_stats.cc b/cc/debug/rendering_stats.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3a27c1d40f80ba9c9a4125335001c967ecb62ec2
--- /dev/null
+++ b/cc/debug/rendering_stats.cc
@@ -0,0 +1,89 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/debug/rendering_stats.h"
+
+namespace cc {
+
+RenderingStats::TimeDeltaList::TimeDeltaList() {
+}
+
+RenderingStats::TimeDeltaList::~TimeDeltaList() {
+}
+
+void RenderingStats::TimeDeltaList::Append(base::TimeDelta value) {
+ values.push_back(value);
+}
+
+void RenderingStats::TimeDeltaList::AddToTracedValue(
+ const char* name,
+ base::trace_event::TracedValue* list_value) const {
+ list_value->BeginArray(name);
+ for (const auto& value : values) {
+ list_value->AppendDouble(value.InMillisecondsF());
+ }
+ list_value->EndArray();
+}
+
+void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) {
+ values.insert(values.end(), other.values.begin(), other.values.end());
+}
+
+base::TimeDelta RenderingStats::TimeDeltaList::GetLastTimeDelta() const {
+ return values.empty() ? base::TimeDelta() : values.back();
+}
+
+RenderingStats::RenderingStats()
+ : frame_count(0),
+ visible_content_area(0),
+ approximated_visible_content_area(0) {
+}
+
+RenderingStats::~RenderingStats() {
+}
+
+scoped_refptr<base::trace_event::ConvertableToTraceFormat>
+RenderingStats::AsTraceableData() const {
+ scoped_refptr<base::trace_event::TracedValue> record_data =
+ new base::trace_event::TracedValue();
+ record_data->SetInteger("frame_count", frame_count);
+ record_data->SetInteger("visible_content_area", visible_content_area);
+ record_data->SetInteger("approximated_visible_content_area",
+ approximated_visible_content_area);
+ draw_duration.AddToTracedValue("draw_duration_ms", record_data.get());
+
+ draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms",
+ record_data.get());
+
+ begin_main_frame_to_commit_duration.AddToTracedValue(
+ "begin_main_frame_to_commit_duration_ms", record_data.get());
+
+ begin_main_frame_to_commit_duration_estimate.AddToTracedValue(
+ "begin_main_frame_to_commit_duration_estimate_ms", record_data.get());
+
+ commit_to_activate_duration.AddToTracedValue("commit_to_activate_duration_ms",
+ record_data.get());
+
+ commit_to_activate_duration_estimate.AddToTracedValue(
+ "commit_to_activate_duration_estimate_ms", record_data.get());
+ return record_data;
+}
+
+void RenderingStats::Add(const RenderingStats& other) {
+ frame_count += other.frame_count;
+ visible_content_area += other.visible_content_area;
+ approximated_visible_content_area += other.approximated_visible_content_area;
+
+ draw_duration.Add(other.draw_duration);
+ draw_duration_estimate.Add(other.draw_duration_estimate);
+ begin_main_frame_to_commit_duration.Add(
+ other.begin_main_frame_to_commit_duration);
+ begin_main_frame_to_commit_duration_estimate.Add(
+ other.begin_main_frame_to_commit_duration_estimate);
+ commit_to_activate_duration.Add(other.commit_to_activate_duration);
+ commit_to_activate_duration_estimate.Add(
+ other.commit_to_activate_duration_estimate);
+}
+
+} // namespace cc
« no previous file with comments | « cc/debug/rendering_stats.h ('k') | cc/debug/rendering_stats_instrumentation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698