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

Side by Side Diff: cc/scheduler/frame_rate_controller.h

Issue 15058004: cc: Rename VSync to BeginFrame (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 7 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
« no previous file with comments | « cc/output/output_surface_client.h ('k') | cc/scheduler/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 CC_SCHEDULER_FRAME_RATE_CONTROLLER_H_ 5 #ifndef CC_SCHEDULER_FRAME_RATE_CONTROLLER_H_
6 #define CC_SCHEDULER_FRAME_RATE_CONTROLLER_H_ 6 #define CC_SCHEDULER_FRAME_RATE_CONTROLLER_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/memory/weak_ptr.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "cc/base/cc_export.h" 12 #include "cc/base/cc_export.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 class Thread; 16 class Thread;
17 class TimeSource; 17 class TimeSource;
18 18
19 class CC_EXPORT FrameRateControllerClient { 19 class CC_EXPORT FrameRateControllerClient {
20 public: 20 public:
21 // Throttled is true when we have a maximum number of frames pending. 21 // Throttled is true when we have a maximum number of frames pending.
22 virtual void VSyncTick(bool throttled) = 0; 22 virtual void BeginFrame(bool throttled) = 0;
23 23
24 protected: 24 protected:
25 virtual ~FrameRateControllerClient() {} 25 virtual ~FrameRateControllerClient() {}
26 }; 26 };
27 27
28 class FrameRateControllerTimeSourceAdapter; 28 class FrameRateControllerTimeSourceAdapter;
29 29
30 class CC_EXPORT FrameRateController { 30 class CC_EXPORT FrameRateController {
31 public: 31 public:
32 enum { 32 enum {
33 DEFAULT_MAX_FRAMES_PENDING = 2 33 DEFAULT_MAX_FRAMES_PENDING = 2
34 }; 34 };
35 35
36 explicit FrameRateController(scoped_refptr<TimeSource> timer); 36 explicit FrameRateController(scoped_refptr<TimeSource> timer);
37 // Alternate form of FrameRateController with unthrottled frame-rate. 37 // Alternate form of FrameRateController with unthrottled frame-rate.
38 explicit FrameRateController(Thread* thread); 38 explicit FrameRateController(Thread* thread);
39 virtual ~FrameRateController(); 39 virtual ~FrameRateController();
40 40
41 void SetClient(FrameRateControllerClient* client) { client_ = client; } 41 void SetClient(FrameRateControllerClient* client) { client_ = client; }
42 42
43 void SetActive(bool active); 43 void SetActive(bool active);
44 44
45 // Use the following methods to adjust target frame rate. 45 // Use the following methods to adjust target frame rate.
46 // 46 //
47 // Multiple frames can be in-progress, but for every DidBeginFrame, a 47 // Multiple frames can be in-progress, but for every DidSwapBuffers, a
48 // DidFinishFrame should be posted. 48 // DidFinishFrame should be posted.
49 // 49 //
50 // If the rendering pipeline crashes, call DidAbortAllPendingFrames. 50 // If the rendering pipeline crashes, call DidAbortAllPendingFrames.
51 void DidBeginFrame(); 51 void DidSwapBuffers();
52 void DidFinishFrame(); 52 void DidSwapBuffersComplete();
53 void DidAbortAllPendingFrames(); 53 void DidAbortAllPendingFrames();
54 void SetMaxFramesPending(int max_frames_pending); // 0 for unlimited. 54 void SetMaxFramesPending(int max_frames_pending); // 0 for unlimited.
55 int MaxFramesPending() const { return max_frames_pending_; } 55 int MaxFramesPending() const { return max_frames_pending_; }
56 int NumFramesPendingForTesting() const { return num_frames_pending_; } 56 int NumFramesPendingForTesting() const { return num_frames_pending_; }
57 57
58 // This returns null for unthrottled frame-rate. 58 // This returns null for unthrottled frame-rate.
59 base::TimeTicks NextTickTime(); 59 base::TimeTicks NextTickTime();
60 60
61 // This returns now for unthrottled frame-rate. 61 // This returns now for unthrottled frame-rate.
62 base::TimeTicks LastTickTime(); 62 base::TimeTicks LastTickTime();
(...skipping 21 matching lines...) Expand all
84 bool is_time_source_throttling_; 84 bool is_time_source_throttling_;
85 base::WeakPtrFactory<FrameRateController> weak_factory_; 85 base::WeakPtrFactory<FrameRateController> weak_factory_;
86 Thread* thread_; 86 Thread* thread_;
87 87
88 DISALLOW_COPY_AND_ASSIGN(FrameRateController); 88 DISALLOW_COPY_AND_ASSIGN(FrameRateController);
89 }; 89 };
90 90
91 } // namespace cc 91 } // namespace cc
92 92
93 #endif // CC_SCHEDULER_FRAME_RATE_CONTROLLER_H_ 93 #endif // CC_SCHEDULER_FRAME_RATE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « cc/output/output_surface_client.h ('k') | cc/scheduler/frame_rate_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698