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

Unified Diff: cc/debug/paint_time_counter.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/paint_time_counter.h ('k') | cc/debug/rendering_stats.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/debug/paint_time_counter.cc
diff --git a/cc/debug/paint_time_counter.cc b/cc/debug/paint_time_counter.cc
new file mode 100644
index 0000000000000000000000000000000000000000..41ef1a334a6a19b8e100ec51a016e99e5f63874f
--- /dev/null
+++ b/cc/debug/paint_time_counter.cc
@@ -0,0 +1,43 @@
+// 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/paint_time_counter.h"
+
+namespace cc {
+
+// static
+scoped_ptr<PaintTimeCounter> PaintTimeCounter::Create() {
+ return make_scoped_ptr(new PaintTimeCounter());
+}
+
+PaintTimeCounter::PaintTimeCounter() {
+}
+
+void PaintTimeCounter::SavePaintTime(const base::TimeDelta& paint_time) {
+ ring_buffer_.SaveToBuffer(paint_time);
+}
+
+void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
+ base::TimeDelta* max) const {
+ *min = base::TimeDelta::FromDays(1);
+ *max = base::TimeDelta();
+
+ for (RingBufferType::Iterator it = ring_buffer_.Begin(); it; ++it) {
+ const base::TimeDelta paint_time = **it;
+
+ if (paint_time < *min)
+ *min = paint_time;
+ if (paint_time > *max)
+ *max = paint_time;
+ }
+
+ if (*min > *max)
+ *min = *max;
+}
+
+void PaintTimeCounter::ClearHistory() {
+ ring_buffer_.Clear();
+}
+
+} // namespace cc
« no previous file with comments | « cc/debug/paint_time_counter.h ('k') | cc/debug/rendering_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698