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_GFX_VSYNC_PROVIDER_H_ | 5 #ifndef UI_GFX_VSYNC_PROVIDER_H_ |
6 #define UI_GFX_VSYNC_PROVIDER_H_ | 6 #define UI_GFX_VSYNC_PROVIDER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "ui/gfx/gfx_export.h" | 10 #include "ui/gfx/gfx_export.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 // Get the time of the most recent screen refresh, along with the time | 22 // Get the time of the most recent screen refresh, along with the time |
23 // between consecutive refreshes. The callback is called as soon as | 23 // between consecutive refreshes. The callback is called as soon as |
24 // the data is available: it could be immediately from this method, | 24 // the data is available: it could be immediately from this method, |
25 // later via a PostTask to the current MessageLoop, or never (if we have | 25 // later via a PostTask to the current MessageLoop, or never (if we have |
26 // no data source). We provide the strong guarantee that the callback will | 26 // no data source). We provide the strong guarantee that the callback will |
27 // not be called once the instance of this class is destroyed. | 27 // not be called once the instance of this class is destroyed. |
28 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) = 0; | 28 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) = 0; |
29 }; | 29 }; |
30 | 30 |
31 // Provides a contant timebase and interval. | |
32 class GFX_EXPORT FixedVSyncProvider : public VSyncProvider { | |
sunnyps
2016/08/25 01:59:29
Do we even need FixedVSyncProvider? If a vsync pro
danakj
2016/08/25 02:04:52
BeginFrameArgs::DefaultInterval is used all over t
brianderson
2016/08/25 05:09:50
I did it this way because I like the decision to u
| |
33 public: | |
34 FixedVSyncProvider(base::TimeTicks timebase, base::TimeDelta interval) | |
35 : timebase_(timebase), interval_(interval) { | |
36 } | |
37 | |
38 ~FixedVSyncProvider() override {} | |
39 | |
40 void GetVSyncParameters(const UpdateVSyncCallback& callback) override; | |
41 | |
42 private: | |
43 base::TimeTicks timebase_; | |
44 base::TimeDelta interval_; | |
45 }; | |
46 | |
31 } // namespace gfx | 47 } // namespace gfx |
32 | 48 |
33 #endif // UI_GFX_VSYNC_PROVIDER_H_ | 49 #endif // UI_GFX_VSYNC_PROVIDER_H_ |
OLD | NEW |