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

Side by Side Diff: ui/compositor/compositor_vsync_manager.h

Issue 1124523003: Revert of Enable BeginFrame scheduling on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « ui/compositor/compositor.gyp ('k') | ui/compositor/compositor_vsync_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 UI_COMPOSITOR_COMPOSITOR_VSYNC_MANAGER_H_
6 #define UI_COMPOSITOR_COMPOSITOR_VSYNC_MANAGER_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/observer_list.h"
10 #include "base/synchronization/lock.h"
11 #include "base/time/time.h"
12 #include "ui/compositor/compositor_export.h"
13
14 namespace ui {
15
16 // This class manages vsync parameters for a compositor. It merges updates of
17 // the parameters from different sources and sends the merged updates to
18 // observers which register to it.
19 class COMPOSITOR_EXPORT CompositorVSyncManager
20 : public base::RefCounted<CompositorVSyncManager> {
21 public:
22 class Observer {
23 public:
24 virtual void OnUpdateVSyncParameters(base::TimeTicks timebase,
25 base::TimeDelta interval) = 0;
26 };
27
28 CompositorVSyncManager();
29
30 // The "authoritative" vsync interval, if provided, will override |interval|
31 // as reported by UpdateVSyncParameters() whenever it is called. This is
32 // typically the value reported by a more reliable source, e.g. the platform
33 // display configuration. In the particular case of ChromeOS -- this is the
34 // value queried through XRandR, which is more reliable than the value
35 // queried through the 3D context.
36 void SetAuthoritativeVSyncInterval(base::TimeDelta interval);
37
38 // The vsync parameters consist of |timebase|, which is the platform timestamp
39 // of the last vsync, and |interval|, which is the interval between vsyncs.
40 // |interval| may be overriden by SetAuthoritativeVSyncInterval() above.
41 void UpdateVSyncParameters(base::TimeTicks timebase,
42 base::TimeDelta interval);
43
44 void AddObserver(Observer* observer);
45 void RemoveObserver(Observer* observer);
46
47 private:
48 friend class base::RefCounted<CompositorVSyncManager>;
49
50 ~CompositorVSyncManager();
51
52 void NotifyObservers(base::TimeTicks timebase, base::TimeDelta interval);
53
54 ObserverList<Observer> observer_list_;
55
56 base::TimeTicks last_timebase_;
57 base::TimeDelta last_interval_;
58 base::TimeDelta authoritative_vsync_interval_;
59
60 DISALLOW_COPY_AND_ASSIGN(CompositorVSyncManager);
61 };
62
63 } // namespace ui
64
65 #endif // UI_COMPOSITOR_COMPOSITOR_VSYNC_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/compositor/compositor.gyp ('k') | ui/compositor/compositor_vsync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698