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

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: Scheduler tests now pass and the code is cleaner. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scheduler/frame_source_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 a80d4495485b602126b7bf1c6ed95c18f9aed6fe..0e7f79335e250acec980917bd35089406a4b42ab 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -15,6 +15,7 @@
#include "cc/base/cc_export.h"
#include "cc/output/begin_frame_args.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"
#include "cc/scheduler/time_source.h"
@@ -23,11 +24,9 @@
namespace cc {
class Thread;
-class SyntheticBeginFrameSource;
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 +47,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 +120,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;
void PostBeginRetroFrame();
void BeginRetroFrame();
- void BeginUnthrottledFrame();
void BeginImplFrame(const BeginFrameArgs& args);
void OnBeginImplFrameDeadline();
@@ -148,6 +149,7 @@ class CC_EXPORT Scheduler {
SchedulerClient* client,
const SchedulerSettings& scheduler_settings,
int layer_tree_host_id,
+ BeginFrameSource* external_frame_source,
const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner);
base::TimeTicks AdjustedBeginImplFrameDeadline(
@@ -156,8 +158,6 @@ class CC_EXPORT Scheduler {
void ScheduleBeginImplFrameDeadline(base::TimeTicks deadline);
void SetupNextBeginFrameIfNeeded();
void PostBeginRetroFrameIfNeeded();
- void SetupNextBeginFrameWhenVSyncThrottlingEnabled(bool needs_begin_frame);
- void SetupNextBeginFrameWhenVSyncThrottlingDisabled(bool needs_begin_frame);
void SetupPollingMechanisms(bool needs_begin_frame);
void DrawAndSwapIfPossible();
void ProcessScheduledActions();
@@ -172,17 +172,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_;
- void SetupSyntheticBeginFrames();
- scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_;
+ scoped_ptr<DualBeginFrameSource> frame_source_;
base::Closure begin_retro_frame_closure_;
base::Closure begin_unthrottled_frame_closure_;
« no previous file with comments | « cc/scheduler/frame_source_unittest.cc ('k') | cc/scheduler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698