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

Unified Diff: cc/scheduler/scheduler.h

Issue 267783004: Refactoring the way begin frame sources inside scheduler work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing onto master. Created 6 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
Index: cc/scheduler/scheduler.h
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index 0965036d3d58ad29102e8ddb41188803ea147e35..3b182bc193748711bb69e7f8f510905b3c49911c 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -16,6 +16,7 @@
#include "cc/output/begin_frame_args.h"
#include "cc/scheduler/delay_based_time_source.h"
#include "cc/scheduler/draw_result.h"
+#include "cc/scheduler/frame_source.h"
#include "cc/scheduler/scheduler_settings.h"
#include "cc/scheduler/scheduler_state_machine.h"
@@ -24,10 +25,10 @@ class SingleThreadTaskRunner;
}
namespace cc {
+class Thread;
simonhong 2014/06/12 13:47:40 We don't need this.
class SchedulerClient {
public:
- virtual void SetNeedsBeginFrame(bool enable) = 0;
virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0;
virtual void ScheduledActionSendBeginMainFrame() = 0;
virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0;
@@ -48,15 +49,19 @@ class SchedulerClient {
virtual ~SchedulerClient() {}
};
-class CC_EXPORT Scheduler {
+class CC_EXPORT Scheduler : public BeginFrameSink {
public:
static scoped_ptr<Scheduler> Create(
SchedulerClient* client,
const SchedulerSettings& scheduler_settings,
int layer_tree_host_id,
+ BeginFrameSource* external_frame_source,
const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner) {
- return make_scoped_ptr(new Scheduler(
- client, scheduler_settings, layer_tree_host_id, impl_task_runner));
+ return make_scoped_ptr(new Scheduler(client,
+ scheduler_settings,
+ layer_tree_host_id,
+ external_frame_source,
+ impl_task_runner));
}
virtual ~Scheduler();
@@ -117,15 +122,13 @@ class CC_EXPORT Scheduler {
void NotifyBeginMainFrameStarted();
base::TimeTicks LastBeginImplFrameTime();
- base::TimeDelta VSyncInterval() { return vsync_interval_; }
base::TimeDelta EstimatedParentDrawTime() {
return estimated_parent_draw_time_;
}
- void BeginFrame(const BeginFrameArgs& args);
+ virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE;
simonhong 2014/06/12 13:47:40 Blank line is needed because this is overrided fro
void PostBeginRetroFrame();
void BeginRetroFrame();
- void BeginUnthrottledFrame();
void BeginImplFrame(const BeginFrameArgs& args);
void OnBeginImplFrameDeadline();
@@ -144,39 +147,11 @@ class CC_EXPORT Scheduler {
}
protected:
- class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient {
- public:
- SyntheticBeginFrameSource(Scheduler* scheduler,
- base::SingleThreadTaskRunner* task_runner);
- virtual ~SyntheticBeginFrameSource();
-
- // Updates the phase and frequency of the timer.
- void CommitVSyncParameters(base::TimeTicks timebase,
- base::TimeDelta interval);
-
- // Activates future BeginFrames and, if activating, pushes the most
- // recently missed BeginFrame to the back of a retroactive queue.
- void SetNeedsBeginFrame(bool needs_begin_frame,
- std::deque<BeginFrameArgs>* begin_retro_frame_args);
-
- bool IsActive() const;
-
- // TimeSourceClient implementation of OnTimerTick triggers a BeginFrame.
- virtual void OnTimerTick() OVERRIDE;
-
- scoped_ptr<base::Value> AsValue() const;
-
- private:
- BeginFrameArgs CreateSyntheticBeginFrameArgs(base::TimeTicks frame_time);
-
- Scheduler* scheduler_;
- scoped_refptr<DelayBasedTimeSource> time_source_;
- };
-
Scheduler(
SchedulerClient* client,
const SchedulerSettings& scheduler_settings,
int layer_tree_host_id,
+ BeginFrameSource* external_frame_source,
const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner);
const SchedulerSettings settings_;
@@ -184,16 +159,13 @@ class CC_EXPORT Scheduler {
int layer_tree_host_id_;
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_;
- base::TimeDelta vsync_interval_;
base::TimeDelta estimated_parent_draw_time_;
- bool last_set_needs_begin_frame_;
- bool begin_unthrottled_frame_posted_;
bool begin_retro_frame_posted_;
std::deque<BeginFrameArgs> begin_retro_frame_args_;
BeginFrameArgs begin_impl_frame_args_;
- scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_;
+ scoped_ptr<DualBeginFrameSource> frame_source_;
base::Closure begin_retro_frame_closure_;
base::Closure begin_unthrottled_frame_closure_;
@@ -224,7 +196,6 @@ class CC_EXPORT Scheduler {
bool CanCommitAndActivateBeforeDeadline() const;
void AdvanceCommitStateIfPossible();
bool IsBeginMainFrameSentOrStarted() const;
- void SetupSyntheticBeginFrames();
base::WeakPtrFactory<Scheduler> weak_factory_;

Powered by Google App Engine
This is Rietveld 408576698