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

Side by Side Diff: cc/frame_rate_controller.h

Issue 11189043: cc: Rename cc classes and members to match filenames (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
OLDNEW
1 // Copyright 2011 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 4
5 #ifndef CCFrameRateController_h 5 #ifndef CCFrameRateController_h
6 #define CCFrameRateController_h 6 #define CCFrameRateController_h
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "CCTimer.h" 11 #include "CCTimer.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 class CCThread; 15 class Thread;
16 class CCTimeSource; 16 class TimeSource;
17 17
18 class CCFrameRateControllerClient { 18 class FrameRateControllerClient {
19 public: 19 public:
20 // Throttled is true when we have a maximum number of frames pending. 20 // Throttled is true when we have a maximum number of frames pending.
21 virtual void vsyncTick(bool throttled) = 0; 21 virtual void vsyncTick(bool throttled) = 0;
22 22
23 protected: 23 protected:
24 virtual ~CCFrameRateControllerClient() {} 24 virtual ~FrameRateControllerClient() {}
25 }; 25 };
26 26
27 class CCFrameRateControllerTimeSourceAdapter; 27 class FrameRateControllerTimeSourceAdapter;
28 28
29 class CCFrameRateController : public CCTimerClient { 29 class FrameRateController : public TimerClient {
30 public: 30 public:
31 explicit CCFrameRateController(scoped_refptr<CCTimeSource>); 31 explicit FrameRateController(scoped_refptr<TimeSource>);
32 // Alternate form of CCFrameRateController with unthrottled frame-rate. 32 // Alternate form of FrameRateController with unthrottled frame-rate.
33 explicit CCFrameRateController(CCThread*); 33 explicit FrameRateController(Thread*);
34 virtual ~CCFrameRateController(); 34 virtual ~FrameRateController();
35 35
36 void setClient(CCFrameRateControllerClient* client) { m_client = client; } 36 void setClient(FrameRateControllerClient* client) { m_client = client; }
37 37
38 void setActive(bool); 38 void setActive(bool);
39 39
40 // Use the following methods to adjust target frame rate. 40 // Use the following methods to adjust target frame rate.
41 // 41 //
42 // Multiple frames can be in-progress, but for every didBeginFrame, a 42 // Multiple frames can be in-progress, but for every didBeginFrame, a
43 // didFinishFrame should be posted. 43 // didFinishFrame should be posted.
44 // 44 //
45 // If the rendering pipeline crashes, call didAbortAllPendingFrames. 45 // If the rendering pipeline crashes, call didAbortAllPendingFrames.
46 void didBeginFrame(); 46 void didBeginFrame();
47 void didFinishFrame(); 47 void didFinishFrame();
48 void didAbortAllPendingFrames(); 48 void didAbortAllPendingFrames();
49 void setMaxFramesPending(int); // 0 for unlimited. 49 void setMaxFramesPending(int); // 0 for unlimited.
50 50
51 // This returns null for unthrottled frame-rate. 51 // This returns null for unthrottled frame-rate.
52 base::TimeTicks nextTickTime(); 52 base::TimeTicks nextTickTime();
53 53
54 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interv al); 54 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interv al);
55 void setSwapBuffersCompleteSupported(bool); 55 void setSwapBuffersCompleteSupported(bool);
56 56
57 protected: 57 protected:
58 friend class CCFrameRateControllerTimeSourceAdapter; 58 friend class FrameRateControllerTimeSourceAdapter;
59 void onTimerTick(); 59 void onTimerTick();
60 60
61 void postManualTick(); 61 void postManualTick();
62 62
63 // CCTimerClient implementation (used for unthrottled frame-rate). 63 // TimerClient implementation (used for unthrottled frame-rate).
64 virtual void onTimerFired() OVERRIDE; 64 virtual void onTimerFired() OVERRIDE;
65 65
66 CCFrameRateControllerClient* m_client; 66 FrameRateControllerClient* m_client;
67 int m_numFramesPending; 67 int m_numFramesPending;
68 int m_maxFramesPending; 68 int m_maxFramesPending;
69 scoped_refptr<CCTimeSource> m_timeSource; 69 scoped_refptr<TimeSource> m_timeSource;
70 scoped_ptr<CCFrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter ; 70 scoped_ptr<FrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter;
71 bool m_active; 71 bool m_active;
72 bool m_swapBuffersCompleteSupported; 72 bool m_swapBuffersCompleteSupported;
73 73
74 // Members for unthrottled frame-rate. 74 // Members for unthrottled frame-rate.
75 bool m_isTimeSourceThrottling; 75 bool m_isTimeSourceThrottling;
76 scoped_ptr<CCTimer> m_manualTicker; 76 scoped_ptr<Timer> m_manualTicker;
77 }; 77 };
78 78
79 } // namespace cc 79 } // namespace cc
80 80
81 #endif // CCFrameRateController_h 81 #endif // CCFrameRateController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698