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

Side by Side Diff: mc/scheduler/scheduler.h

Issue 731893002: Add a simple scheduler for animation frames (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix math Created 6 years, 1 month 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 | « mc/scheduler/DEPS ('k') | mc/scheduler/scheduler.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 MC_SCHEDULER_SCHEDULER_H_
6 #define MC_SCHEDULER_SCHEDULER_H_
7
8 #include "base/single_thread_task_runner.h"
9 #include "base/time/time.h"
10 #include "mc/scheduler/timer.h"
11
12 namespace mc {
13
14 class Scheduler : public Timer::Client {
15 public:
16 class Client {
17 public:
18 virtual void BeginFrame(base::TimeTicks frame_time,
19 base::TimeTicks deadline) = 0;
20
21 protected:
22 virtual ~Client();
23 };
24
25 Scheduler(Client* client,
26 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
27 ~Scheduler();
28
29 void UpdateFrameDuration(base::TimeDelta estimate);
30 void UpdateVSync(const TimeInterval& vsync);
31
32 void SetNeedsFrame();
33
34 private:
35 void UpdateTimerInterval();
36 void OnTimerTick(base::TimeTicks now) override;
37
38 Client* client_;
39 Timer timer_;
40 TimeInterval vsync_;
41 base::TimeDelta frame_duration_;
42 };
43 }
44
45 #endif // MC_SCHEDULER_SCHEDULER_H_
OLDNEW
« no previous file with comments | « mc/scheduler/DEPS ('k') | mc/scheduler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698