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

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: added DCHECKS for wrong buffer reads and divide by 0 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
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 d15893ad3b9bb958c03cfc81f6dea7f126a4d471..1184423b5027d05a9099586dd6207854fab08c3c 100644
--- a/cc/heads_up_display_layer_impl.cc
+++ b/cc/heads_up_display_layer_impl.cc
@@ -214,9 +214,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.

Powered by Google App Engine
This is Rietveld 408576698