Add signalSyncPoint to the WebGraphicsContext3D command buffer impls.
[chromium-blink-merge.git] / cc / scheduler / vsync_time_source.h
blob910168f26bdc315c9d3b428bd0634d28b1539078
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.
5 #ifndef CC_SCHEDULER_VSYNC_TIME_SOURCE_H_
6 #define CC_SCHEDULER_VSYNC_TIME_SOURCE_H_
8 #include "cc/base/cc_export.h"
9 #include "cc/scheduler/time_source.h"
11 namespace cc {
13 class CC_EXPORT VSyncClient {
14 public:
15 virtual void DidVSync(base::TimeTicks frame_time) = 0;
17 protected:
18 virtual ~VSyncClient() {}
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;
28 protected:
29 virtual ~VSyncProvider() {}
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 static scoped_refptr<VSyncTimeSource> Create(VSyncProvider* vsync_provider);
38 // TimeSource implementation
39 virtual void SetClient(TimeSourceClient* client) OVERRIDE;
40 virtual void SetTimebaseAndInterval(base::TimeTicks timebase,
41 base::TimeDelta interval) OVERRIDE;
42 virtual void SetActive(bool active) OVERRIDE;
43 virtual bool Active() const OVERRIDE;
44 virtual base::TimeTicks LastTickTime() OVERRIDE;
45 virtual base::TimeTicks NextTickTime() OVERRIDE;
47 // VSyncClient implementation
48 virtual void DidVSync(base::TimeTicks frame_time) OVERRIDE;
50 protected:
51 explicit VSyncTimeSource(VSyncProvider* vsync_provider);
52 virtual ~VSyncTimeSource();
54 base::TimeTicks last_tick_time_;
55 base::TimeDelta interval_;
56 bool active_;
57 bool notification_requested_;
59 VSyncProvider* vsync_provider_;
60 TimeSourceClient* client_;
62 DISALLOW_COPY_AND_ASSIGN(VSyncTimeSource);
65 } // namespace cc
67 #endif // CC_SCHEDULER_VSYNC_TIME_SOURCE_H_