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

Unified Diff: cc/scheduler/scheduler.h

Issue 16833003: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « cc/scheduler/frame_rate_controller_unittest.cc ('k') | cc/scheduler/scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler.h
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index 6ecd8893126c8b1993f9aa0e0a460ee74fefcc9a..d8151fa910ccf2a7fe67de693d4a7d34b7cd2ebd 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -11,7 +11,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
#include "cc/base/cc_export.h"
-#include "cc/scheduler/frame_rate_controller.h"
#include "cc/scheduler/scheduler_settings.h"
#include "cc/scheduler/scheduler_state_machine.h"
#include "cc/trees/layer_tree_host.h"
@@ -33,6 +32,7 @@ struct ScheduledActionDrawAndSwapResult {
class SchedulerClient {
public:
+ virtual void SetNeedsBeginFrameOnImplThread(bool enable) = 0;
virtual void ScheduledActionSendBeginFrameToMainThread() = 0;
virtual ScheduledActionDrawAndSwapResult
ScheduledActionDrawAndSwapIfPossible() = 0;
@@ -49,14 +49,12 @@ class SchedulerClient {
virtual ~SchedulerClient() {}
};
-class CC_EXPORT Scheduler : FrameRateControllerClient {
+class CC_EXPORT Scheduler {
public:
static scoped_ptr<Scheduler> Create(
SchedulerClient* client,
- scoped_ptr<FrameRateController> frame_rate_controller,
const SchedulerSettings& scheduler_settings) {
- return make_scoped_ptr(new Scheduler(
- client, frame_rate_controller.Pass(), scheduler_settings));
+ return make_scoped_ptr(new Scheduler(client, scheduler_settings));
}
virtual ~Scheduler();
@@ -86,12 +84,6 @@ class CC_EXPORT Scheduler : FrameRateControllerClient {
void FinishCommit();
void BeginFrameAbortedByMainThread();
- void SetMaxFramesPending(int max);
- int MaxFramesPending() const;
- int NumFramesPendingForTesting() const;
-
- void DidSwapBuffersComplete();
-
void DidLoseOutputSurface();
void DidCreateAndInitializeOutputSurface();
bool HasInitializedOutputSurface() const {
@@ -103,28 +95,32 @@ class CC_EXPORT Scheduler : FrameRateControllerClient {
bool WillDrawIfNeeded() const;
- void SetTimebaseAndInterval(base::TimeTicks timebase,
- base::TimeDelta interval);
-
base::TimeTicks AnticipatedDrawTime();
base::TimeTicks LastBeginFrameOnImplThreadTime();
- // FrameRateControllerClient implementation
- virtual void BeginFrame(bool throttled) OVERRIDE;
+ void BeginFrame(base::TimeTicks frame_time);
std::string StateAsStringForTesting() { return state_machine_.ToString(); }
private:
Scheduler(SchedulerClient* client,
- scoped_ptr<FrameRateController> frame_rate_controller,
const SchedulerSettings& scheduler_settings);
+ void SetupNextBeginFrameIfNeeded();
+ void DrawAndSwapIfPossible();
+ void DrawAndSwapForced();
void ProcessScheduledActions();
const SchedulerSettings settings_;
SchedulerClient* client_;
- scoped_ptr<FrameRateController> frame_rate_controller_;
+
+ base::WeakPtrFactory<Scheduler> weak_factory_;
+ bool last_set_needs_begin_frame_;
+ bool has_pending_begin_frame_;
+ base::TimeTicks last_begin_frame_time_;
+ base::TimeDelta interval_;
+
SchedulerStateMachine state_machine_;
bool inside_process_scheduled_actions_;
« no previous file with comments | « cc/scheduler/frame_rate_controller_unittest.cc ('k') | cc/scheduler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698