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

Unified Diff: cc/heads_up_display_layer_impl.cc

Issue 11817011: cc: add RingBuffer class for timestamp storing in FrameRateCounter (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cleaner test fix Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/frame_rate_counter.cc ('k') | cc/layer_tree_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/heads_up_display_layer_impl.cc
diff --git a/cc/heads_up_display_layer_impl.cc b/cc/heads_up_display_layer_impl.cc
index 9aa1e0c59fa60b3eb27e35db053aefa1c047b7d5..190229667783378229e0a45590080b10a1e87b2a 100644
--- a/cc/heads_up_display_layer_impl.cc
+++ b/cc/heads_up_display_layer_impl.cc
@@ -215,9 +215,10 @@ int HeadsUpDisplayLayerImpl::drawFPSCounter(SkCanvas* canvas, FrameRateCounter*
void HeadsUpDisplayLayerImpl::drawFPSCounterText(SkCanvas* canvas, SkPaint& paint, FrameRateCounter* fpsCounter, SkRect bounds)
{
// Update FPS text - not every frame so text is readable
- if (base::TimeDelta(fpsCounter->timeStampOfRecentFrame(0) - textUpdateTime).InSecondsF() > 0.25) {
+ base::TimeTicks now = base::TimeTicks::Now();
+ if (base::TimeDelta(now - textUpdateTime).InSecondsF() > 0.25) {
m_averageFPS = fpsCounter->getAverageFPS();
- textUpdateTime = fpsCounter->timeStampOfRecentFrame(0);
+ textUpdateTime = now;
}
// Draw FPS text.
@@ -260,7 +261,7 @@ void HeadsUpDisplayLayerImpl::drawFPSCounterGraphAndHistogram(SkCanvas* canvas,
double histogram[histogramSize] = {0};
double maxBucketValue = 0;
- for (int i = 1; i < fpsCounter->timeStampHistorySize() - 1; ++i) {
+ for (size_t i = 1; i < fpsCounter->timeStampHistorySize() - 1; ++i) {
base::TimeDelta delta = fpsCounter->timeStampOfRecentFrame(i + 1) - fpsCounter->timeStampOfRecentFrame(i);
// Skip this particular instantaneous frame rate if it is not likely to have been valid.
« no previous file with comments | « cc/frame_rate_counter.cc ('k') | cc/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698