Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_PAINT_TIME_COUNTER_H_ | |
| 6 #define CC_PAINT_TIME_COUNTER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "cc/ring_buffer.h" | |
| 11 | |
| 12 namespace cc { | |
| 13 | |
| 14 // Maintains a history of paint times for each frame in milliseconds | |
| 15 class PaintTimeCounter { | |
| 16 public: | |
| 17 static scoped_ptr<PaintTimeCounter> create(); | |
| 18 | |
| 19 size_t HistorySize() const { return ring_buffer_.BufferSize(); } | |
|
reveman
2013/01/11 16:10:49
nit: fix indent
| |
| 20 | |
| 21 // n = 0 returns the oldest and | |
| 22 // n = PaintTimeHistorySize() - 1 the most recent paint time. | |
| 23 double GetPaintTimeOfRecentFrame(int n) const; | |
|
reveman
2013/01/11 16:10:49
also here
| |
| 24 | |
| 25 void SavePaintTime(double total_paint_time); | |
| 26 void GetMinAndMaxPaintTime(double& min, double& max) const; | |
| 27 | |
| 28 private: | |
| 29 PaintTimeCounter(); | |
|
reveman
2013/01/11 16:10:49
and here
| |
| 30 | |
| 31 RingBuffer<double, 80> ring_buffer_; | |
|
reveman
2013/01/11 16:10:49
here
| |
| 32 double last_paint_time_; | |
| 33 | |
| 34 DISALLOW_COPY_AND_ASSIGN(PaintTimeCounter); | |
| 35 }; | |
| 36 | |
| 37 } // namespace cc | |
| 38 | |
| 39 #endif // CC_PAINT_TIME_COUNTER_H_ | |
| OLD | NEW |