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

Side by Side Diff: cc/scheduler/vsync_time_source.h

Issue 16833003: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 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 | « cc/scheduler/scheduler_unittest.cc ('k') | cc/scheduler/vsync_time_source.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 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_SCHEDULER_VSYNC_TIME_SOURCE_H_
6 #define CC_SCHEDULER_VSYNC_TIME_SOURCE_H_
7
8 #include "cc/base/cc_export.h"
9 #include "cc/scheduler/time_source.h"
10
11 namespace cc {
12
13 class CC_EXPORT VSyncClient {
14 public:
15 virtual void DidVSync(base::TimeTicks frame_time) = 0;
16
17 protected:
18 virtual ~VSyncClient() {}
19 };
20
21 class VSyncProvider {
22 public:
23 // Request to be notified of future vsync events. The notifications will be
24 // delivered until they are disabled by calling this function with a null
25 // client.
26 virtual void RequestVSyncNotification(VSyncClient* client) = 0;
27
28 protected:
29 virtual ~VSyncProvider() {}
30 };
31
32 // This timer implements a time source that is explicitly triggered by an
33 // external vsync signal.
34 class CC_EXPORT VSyncTimeSource : public TimeSource, public VSyncClient {
35 public:
36 enum NotificationDisableOption {
37 // The notification will be lazily disabled in the callback to ensure
38 // we get notified of the frame immediately following a quick on-off-on
39 // transition.
40 DISABLE_ON_NEXT_TICK,
41 DISABLE_SYNCHRONOUSLY
42 };
43
44 static scoped_refptr<VSyncTimeSource> Create(
45 VSyncProvider* vsync_provider, NotificationDisableOption option);
46
47 // TimeSource implementation
48 virtual void SetClient(TimeSourceClient* client) OVERRIDE;
49 virtual void SetTimebaseAndInterval(base::TimeTicks timebase,
50 base::TimeDelta interval) OVERRIDE;
51 virtual void SetActive(bool active) OVERRIDE;
52 virtual bool Active() const OVERRIDE;
53 virtual base::TimeTicks LastTickTime() OVERRIDE;
54 virtual base::TimeTicks NextTickTime() OVERRIDE;
55
56 // VSyncClient implementation
57 virtual void DidVSync(base::TimeTicks frame_time) OVERRIDE;
58
59 protected:
60 explicit VSyncTimeSource(VSyncProvider* vsync_provider,
61 NotificationDisableOption option);
62 virtual ~VSyncTimeSource();
63
64 base::TimeTicks last_tick_time_;
65 base::TimeDelta interval_;
66 bool active_;
67 bool notification_requested_;
68
69 VSyncProvider* vsync_provider_;
70 TimeSourceClient* client_;
71 NotificationDisableOption disable_option_;
72
73 DISALLOW_COPY_AND_ASSIGN(VSyncTimeSource);
74 };
75
76 } // namespace cc
77
78 #endif // CC_SCHEDULER_VSYNC_TIME_SOURCE_H_
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_unittest.cc ('k') | cc/scheduler/vsync_time_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698