OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GL_VSYNC_PROVIDER_H_ | 5 #ifndef UI_GL_VSYNC_PROVIDER_H_ |
6 #define UI_GL_VSYNC_PROVIDER_H_ | 6 #define UI_GL_VSYNC_PROVIDER_H_ |
7 | 7 |
| 8 #include <queue> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/time.h" | 12 #include "base/time.h" |
11 | 13 |
12 namespace gfx { | 14 namespace gfx { |
13 | 15 |
14 class VSyncProvider { | 16 class VSyncProvider { |
15 public: | 17 public: |
16 VSyncProvider(); | 18 VSyncProvider(); |
17 virtual ~VSyncProvider(); | 19 virtual ~VSyncProvider(); |
(...skipping 29 matching lines...) Expand all Loading... |
47 int64* media_stream_counter, | 49 int64* media_stream_counter, |
48 int64* swap_buffer_counter) = 0; | 50 int64* swap_buffer_counter) = 0; |
49 | 51 |
50 virtual bool GetMscRate(int32* numerator, int32* denominator) = 0; | 52 virtual bool GetMscRate(int32* numerator, int32* denominator) = 0; |
51 | 53 |
52 private: | 54 private: |
53 base::TimeTicks last_timebase_; | 55 base::TimeTicks last_timebase_; |
54 uint64 last_media_stream_counter_; | 56 uint64 last_media_stream_counter_; |
55 base::TimeDelta last_good_interval_; | 57 base::TimeDelta last_good_interval_; |
56 | 58 |
| 59 // A short history of the last few computed intervals. |
| 60 // We use this to filter out the noise in the computation resulting |
| 61 // from configuration change (monitor reconfiguration, moving windows |
| 62 // between monitors, suspend and resume, etc.). |
| 63 std::queue<base::TimeDelta> last_computed_intervals_; |
| 64 |
57 DISALLOW_COPY_AND_ASSIGN(SyncControlVSyncProvider); | 65 DISALLOW_COPY_AND_ASSIGN(SyncControlVSyncProvider); |
58 }; | 66 }; |
59 | 67 |
60 } // namespace gfx | 68 } // namespace gfx |
61 | 69 |
62 #endif // UI_GL_VSYNC_PROVIDER_H_ | 70 #endif // UI_GL_VSYNC_PROVIDER_H_ |
OLD | NEW |