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

Unified Diff: cc/scheduler/frame_rate_controller.h

Issue 199523002: cc: Throttle swaps in Scheduler instead of OutputSurface (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: WIP: pulling FRC out of OS Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: cc/scheduler/frame_rate_controller.h
diff --git a/cc/scheduler/frame_rate_controller.h b/cc/scheduler/frame_rate_controller.h
index 6d86d97496679c4efb629c8b8e5b7dadacf405bd..d14c16bcd3ce3dc250561ffff697e4b61c6ac27a 100644
--- a/cc/scheduler/frame_rate_controller.h
+++ b/cc/scheduler/frame_rate_controller.h
@@ -11,36 +11,32 @@
#include "base/time/time.h"
#include "cc/base/cc_export.h"
#include "cc/output/begin_frame_args.h"
+#include "cc/scheduler/time_source.h"
namespace base { class SingleThreadTaskRunner; }
namespace cc {
class TimeSource;
-class FrameRateController;
+class BeginFrameSource;
-class CC_EXPORT FrameRateControllerClient {
+class CC_EXPORT BeginFrameSourceClient {
protected:
- virtual ~FrameRateControllerClient() {}
+ virtual ~BeginFrameSourceClient() {}
public:
- // Throttled is true when we have a maximum number of frames pending.
- virtual void FrameRateControllerTick(bool throttled,
- const BeginFrameArgs& args) = 0;
+ virtual void BeginImplFrame(const BeginFrameArgs& args) = 0;
};
-class FrameRateControllerTimeSourceAdapter;
-
-// The FrameRateController is used in cases where we self-tick (i.e. BeginFrame
+// The BeginFrameSource is used in cases where we self-tick (i.e. BeginFrame
// is not sent by a parent compositor.
-class CC_EXPORT FrameRateController {
+class CC_EXPORT BeginFrameSource : TimeSourceClient {
Sami 2014/03/14 15:34:58 I wonder if we should call this something like Syn
public:
- explicit FrameRateController(scoped_refptr<TimeSource> timer);
- // Alternate form of FrameRateController with unthrottled frame-rate.
- explicit FrameRateController(base::SingleThreadTaskRunner* task_runner);
- virtual ~FrameRateController();
+ explicit BeginFrameSource(base::TimeDelta interval,
+ base::SingleThreadTaskRunner* task_runner);
+ virtual ~BeginFrameSource();
- void SetClient(FrameRateControllerClient* client) { client_ = client; }
+ void SetClient(BeginFrameSourceClient* client) { client_ = client; }
// Returns a valid BeginFrame on activation to potentially be used
// retroactively.
@@ -48,52 +44,26 @@ class CC_EXPORT FrameRateController {
bool IsActive() { return active_; }
- // Use the following methods to adjust target frame rate.
- //
- // Multiple frames can be in-progress, but for every DidSwapBuffers, a
- // DidFinishFrame should be posted.
- //
- // If the rendering pipeline crashes, call DidAbortAllPendingFrames.
- void DidSwapBuffers();
- void DidSwapBuffersComplete();
- void DidAbortAllPendingFrames();
- void SetMaxSwapsPending(int max_swaps_pending); // 0 for unlimited.
- int MaxSwapsPending() const { return max_swaps_pending_; }
- int NumSwapsPendingForTesting() const { return num_frames_pending_; }
-
void SetTimebaseAndInterval(base::TimeTicks timebase,
base::TimeDelta interval);
void SetDeadlineAdjustment(base::TimeDelta delta);
- protected:
- friend class FrameRateControllerTimeSourceAdapter;
- void OnTimerTick();
-
- void PostManualTick();
- void ManualTick();
+ virtual void OnTimerTick() OVERRIDE;
+ protected:
// This returns null for unthrottled frame-rate.
base::TimeTicks NextTickTime();
// This returns now for unthrottled frame-rate.
base::TimeTicks LastTickTime();
- FrameRateControllerClient* client_;
- int num_frames_pending_;
- int max_swaps_pending_;
+ BeginFrameSourceClient* client_;
base::TimeDelta interval_;
base::TimeDelta deadline_adjustment_;
scoped_refptr<TimeSource> time_source_;
- scoped_ptr<FrameRateControllerTimeSourceAdapter> time_source_client_adapter_;
bool active_;
- // Members for unthrottled frame-rate.
- bool is_time_source_throttling_;
- bool manual_tick_pending_;
- base::SingleThreadTaskRunner* task_runner_;
- base::WeakPtrFactory<FrameRateController> weak_factory_;
-
private:
- DISALLOW_COPY_AND_ASSIGN(FrameRateController);
+ DISALLOW_COPY_AND_ASSIGN(BeginFrameSource);
};
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698