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

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: 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 177f349558981a9a7d302b80ad99d555fb2c584b..07d8e2d8c324b680101dcd91964e87363e148e85 100644
--- a/cc/heads_up_display_layer_impl.cc
+++ b/cc/heads_up_display_layer_impl.cc
@@ -178,7 +178,7 @@ int HeadsUpDisplayLayerImpl::drawFPSCounter(SkCanvas* canvas, FrameRateCounter*
const int fontHeight = m_fontAtlas.get() ? m_fontAtlas->fontHeight() : 0;
- const int graphWidth = fpsCounter->timeStampHistorySize() - 3;
+ const int graphWidth = fpsCounter->bufferSize() - 3;
const int graphHeight = 40;
const int histogramWidth = 37;
@@ -208,9 +208,9 @@ 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) {
+ if (base::TimeDelta(fpsCounter->readBuffer(0) - textUpdateTime).InSecondsF() > 0.25) {
shawnsingh 2013/01/09 20:55:09 Personally, as I'm reading the code here, I would
m_averageFPS = fpsCounter->getAverageFPS();
- textUpdateTime = fpsCounter->timeStampOfRecentFrame(0);
+ textUpdateTime = fpsCounter->readBuffer(0);
}
// Draw FPS text.
@@ -253,8 +253,8 @@ void HeadsUpDisplayLayerImpl::drawFPSCounterGraphAndHistogram(SkCanvas* canvas,
double histogram[histogramSize] = {0};
double maxBucketValue = 0;
- for (int i = 1; i < fpsCounter->timeStampHistorySize() - 1; ++i) {
- base::TimeDelta delta = fpsCounter->timeStampOfRecentFrame(i + 1) - fpsCounter->timeStampOfRecentFrame(i);
+ for (int i = 1; i < fpsCounter->bufferSize() - 1; ++i) {
+ base::TimeDelta delta = fpsCounter->readBuffer(i + 1) - fpsCounter->readBuffer(i);
// Skip this particular instantaneous frame rate if it is not likely to have been valid.
if (!fpsCounter->isBadFrameInterval(delta)) {

Powered by Google App Engine
This is Rietveld 408576698