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

Side by Side Diff: cc/delay_based_time_source.h

Issue 11122003: [cc] Rename all cc/ filenames to Chromium style (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « cc/debug_rect_history.cc ('k') | cc/delay_based_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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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
5 #ifndef CCDelayBasedTimeSource_h
6 #define CCDelayBasedTimeSource_h
7
8 #include "CCTimeSource.h"
9 #include "CCTimer.h"
10 #include <wtf/PassRefPtr.h>
11
12 namespace cc {
13
14 class CCThread;
15
16 // This timer implements a time source that achieves the specified interval
17 // in face of millisecond-precision delayed callbacks and random queueing delays .
18 class CCDelayBasedTimeSource : public CCTimeSource, CCTimerClient {
19 public:
20 static PassRefPtr<CCDelayBasedTimeSource> create(base::TimeDelta interval, C CThread*);
21
22 virtual ~CCDelayBasedTimeSource();
23
24 virtual void setClient(CCTimeSourceClient* client) OVERRIDE;
25
26 // CCTimeSource implementation
27 virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelt a interval) OVERRIDE;
28
29 virtual void setActive(bool) OVERRIDE;
30 virtual bool active() const OVERRIDE;
31
32 // Get the last and next tick times. nextTimeTime() returns null when
33 // inactive.
34 virtual base::TimeTicks lastTickTime() OVERRIDE;
35 virtual base::TimeTicks nextTickTime() OVERRIDE;
36
37 // CCTimerClient implementation.
38 virtual void onTimerFired() OVERRIDE;
39
40 // Virtual for testing.
41 virtual base::TimeTicks now() const;
42
43 protected:
44 CCDelayBasedTimeSource(base::TimeDelta interval, CCThread*);
45 base::TimeTicks nextTickTarget(base::TimeTicks now);
46 void postNextTickTask(base::TimeTicks now);
47
48 enum State {
49 STATE_INACTIVE,
50 STATE_STARTING,
51 STATE_ACTIVE,
52 };
53
54 struct Parameters {
55 Parameters(base::TimeDelta interval, base::TimeTicks tickTarget)
56 : interval(interval), tickTarget(tickTarget)
57 { }
58 base::TimeDelta interval;
59 base::TimeTicks tickTarget;
60 };
61
62 CCTimeSourceClient* m_client;
63 bool m_hasTickTarget;
64 base::TimeTicks m_lastTickTime;
65
66 // m_currentParameters should only be written by postNextTickTask.
67 // m_nextParameters will take effect on the next call to postNextTickTask.
68 // Maintaining a pending set of parameters allows nextTickTime() to always
69 // reflect the actual time we expect onTimerFired to be called.
70 Parameters m_currentParameters;
71 Parameters m_nextParameters;
72
73 State m_state;
74 CCThread* m_thread;
75 CCTimer m_timer;
76 };
77
78 }
79 #endif // CCDelayBasedTimeSource_h
OLDNEW
« no previous file with comments | « cc/debug_rect_history.cc ('k') | cc/delay_based_time_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698