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

Side by Side Diff: cc/frame_rate_controller.h

Issue 11344004: Remove WebKit::Platform dependencies from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix webkit_compositor_bindings_unittests Created 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/delay_based_time_source.cc ('k') | cc/frame_rate_controller.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 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/memory/weak_ptr.h"
10 #include "base/time.h" 11 #include "base/time.h"
11 #include "cc/timer.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 class Thread; 15 class Thread;
16 class TimeSource; 16 class TimeSource;
17 17
18 class FrameRateControllerClient { 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 ~FrameRateControllerClient() {} 24 virtual ~FrameRateControllerClient() {}
25 }; 25 };
26 26
27 class FrameRateControllerTimeSourceAdapter; 27 class FrameRateControllerTimeSourceAdapter;
28 28
29 class FrameRateController : public TimerClient { 29 class FrameRateController {
30 public: 30 public:
31 explicit FrameRateController(scoped_refptr<TimeSource>); 31 explicit FrameRateController(scoped_refptr<TimeSource>);
32 // Alternate form of FrameRateController with unthrottled frame-rate. 32 // Alternate form of FrameRateController with unthrottled frame-rate.
33 explicit FrameRateController(Thread*); 33 explicit FrameRateController(Thread*);
34 virtual ~FrameRateController(); 34 virtual ~FrameRateController();
35 35
36 void setClient(FrameRateControllerClient* client) { m_client = client; } 36 void setClient(FrameRateControllerClient* client) { m_client = client; }
37 37
38 void setActive(bool); 38 void setActive(bool);
39 39
(...skipping 12 matching lines...) Expand all
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 FrameRateControllerTimeSourceAdapter; 58 friend class FrameRateControllerTimeSourceAdapter;
59 void onTimerTick(); 59 void onTimerTick();
60 60
61 void postManualTick(); 61 void postManualTick();
62 62 void manualTick();
63 // TimerClient implementation (used for unthrottled frame-rate).
64 virtual void onTimerFired() OVERRIDE;
65 63
66 FrameRateControllerClient* m_client; 64 FrameRateControllerClient* m_client;
67 int m_numFramesPending; 65 int m_numFramesPending;
68 int m_maxFramesPending; 66 int m_maxFramesPending;
69 scoped_refptr<TimeSource> m_timeSource; 67 scoped_refptr<TimeSource> m_timeSource;
70 scoped_ptr<FrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter; 68 scoped_ptr<FrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter;
71 bool m_active; 69 bool m_active;
72 bool m_swapBuffersCompleteSupported; 70 bool m_swapBuffersCompleteSupported;
73 71
74 // Members for unthrottled frame-rate. 72 // Members for unthrottled frame-rate.
75 bool m_isTimeSourceThrottling; 73 bool m_isTimeSourceThrottling;
76 scoped_ptr<Timer> m_manualTicker; 74 base::WeakPtrFactory<FrameRateController> m_weakFactory;
75 Thread* m_thread;
76
77 DISALLOW_COPY_AND_ASSIGN(FrameRateController);
77 }; 78 };
78 79
79 } // namespace cc 80 } // namespace cc
80 81
81 #endif // CCFrameRateController_h 82 #endif // CCFrameRateController_h
OLDNEW
« no previous file with comments | « cc/delay_based_time_source.cc ('k') | cc/frame_rate_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698