OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_SYNC_CONTROL_VSYNC_PROVIDER_H_ | 5 #ifndef UI_GL_SYNC_CONTROL_VSYNC_PROVIDER_H_ |
6 #define UI_GL_SYNC_CONTROL_VSYNC_PROVIDER_H_ | 6 #define UI_GL_SYNC_CONTROL_VSYNC_PROVIDER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "ui/gfx/vsync_provider.h" | 10 #include "ui/gfx/vsync_provider.h" |
11 | 11 |
12 namespace gfx { | 12 namespace gfx { |
13 | 13 |
14 // Base class for providers based on extensions like GLX_OML_sync_control and | 14 // Base class for providers based on extensions like GLX_OML_sync_control and |
15 // EGL_CHROMIUM_sync_control. | 15 // EGL_CHROMIUM_sync_control. |
16 class SyncControlVSyncProvider : public VSyncProvider { | 16 class SyncControlVSyncProvider : public VSyncProvider { |
17 public: | 17 public: |
18 SyncControlVSyncProvider(); | 18 SyncControlVSyncProvider(); |
19 virtual ~SyncControlVSyncProvider(); | 19 virtual ~SyncControlVSyncProvider(); |
20 | 20 |
21 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) OVERRIDE; | 21 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) override; |
22 | 22 |
23 protected: | 23 protected: |
24 virtual bool GetSyncValues(int64* system_time, | 24 virtual bool GetSyncValues(int64* system_time, |
25 int64* media_stream_counter, | 25 int64* media_stream_counter, |
26 int64* swap_buffer_counter) = 0; | 26 int64* swap_buffer_counter) = 0; |
27 | 27 |
28 virtual bool GetMscRate(int32* numerator, int32* denominator) = 0; | 28 virtual bool GetMscRate(int32* numerator, int32* denominator) = 0; |
29 | 29 |
30 private: | 30 private: |
31 base::TimeTicks last_timebase_; | 31 base::TimeTicks last_timebase_; |
32 uint64 last_media_stream_counter_; | 32 uint64 last_media_stream_counter_; |
33 base::TimeDelta last_good_interval_; | 33 base::TimeDelta last_good_interval_; |
34 bool invalid_msc_; | 34 bool invalid_msc_; |
35 | 35 |
36 // A short history of the last few computed intervals. | 36 // A short history of the last few computed intervals. |
37 // We use this to filter out the noise in the computation resulting | 37 // We use this to filter out the noise in the computation resulting |
38 // from configuration change (monitor reconfiguration, moving windows | 38 // from configuration change (monitor reconfiguration, moving windows |
39 // between monitors, suspend and resume, etc.). | 39 // between monitors, suspend and resume, etc.). |
40 std::queue<base::TimeDelta> last_computed_intervals_; | 40 std::queue<base::TimeDelta> last_computed_intervals_; |
41 | 41 |
42 DISALLOW_COPY_AND_ASSIGN(SyncControlVSyncProvider); | 42 DISALLOW_COPY_AND_ASSIGN(SyncControlVSyncProvider); |
43 }; | 43 }; |
44 | 44 |
45 } // namespace gfx | 45 } // namespace gfx |
46 | 46 |
47 #endif // UI_GL_SYNC_CONTROL_VSYNC_PROVIDER_H_ | 47 #endif // UI_GL_SYNC_CONTROL_VSYNC_PROVIDER_H_ |
OLD | NEW |