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

Unified Diff: cc/scheduler/scheduler.h

Issue 1201573002: cc: Remove BeginFrameSourcesConstructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 408bd4cc9f56e25ea2ad66a4f93022554ce1b982..05a0a59cf8e3b8c3c905c673bea201dffd064ca6 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -14,7 +14,6 @@
#include "base/time/time.h"
#include "cc/base/cc_export.h"
#include "cc/output/begin_frame_args.h"
-#include "cc/output/vsync_parameter_observer.h"
#include "cc/scheduler/begin_frame_source.h"
#include "cc/scheduler/begin_frame_tracker.h"
#include "cc/scheduler/delay_based_time_source.h"
@@ -55,40 +54,14 @@ class SchedulerClient {
virtual ~SchedulerClient() {}
};
-class Scheduler;
-// This class exists to allow tests to override the frame source construction.
-// A virtual method can't be used as this needs to happen in the constructor
-// (see C++ FAQ / Section 23 - http://goo.gl/fnrwom for why).
-// This class exists solely long enough to construct the frame sources.
-class CC_EXPORT SchedulerFrameSourcesConstructor {
- public:
- virtual ~SchedulerFrameSourcesConstructor() {}
- virtual BeginFrameSource* ConstructPrimaryFrameSource(Scheduler* scheduler);
- virtual BeginFrameSource* ConstructUnthrottledFrameSource(
- Scheduler* scheduler);
-
- protected:
- SchedulerFrameSourcesConstructor() {}
-
- friend class Scheduler;
-};
-
class CC_EXPORT Scheduler : public BeginFrameObserverBase {
public:
static scoped_ptr<Scheduler> Create(
SchedulerClient* client,
const SchedulerSettings& scheduler_settings,
int layer_tree_host_id,
- const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
- scoped_ptr<BeginFrameSource> external_begin_frame_source) {
- SchedulerFrameSourcesConstructor frame_sources_constructor;
- return make_scoped_ptr(new Scheduler(client,
- scheduler_settings,
- layer_tree_host_id,
- task_runner,
- external_begin_frame_source.Pass(),
- &frame_sources_constructor));
- }
+ base::SingleThreadTaskRunner* task_runner,
+ BeginFrameSource* external_frame_source);
~Scheduler() override;
@@ -180,33 +153,29 @@ class CC_EXPORT Scheduler : public BeginFrameObserverBase {
Scheduler(SchedulerClient* client,
const SchedulerSettings& scheduler_settings,
int layer_tree_host_id,
- const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
- scoped_ptr<BeginFrameSource> external_begin_frame_source,
- SchedulerFrameSourcesConstructor* frame_sources_constructor);
+ base::SingleThreadTaskRunner* task_runner,
+ BeginFrameSource* external_frame_source,
+ scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source,
+ scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source);
// virtual for testing - Don't call these in the constructor or
// destructor!
virtual base::TimeTicks Now() const;
- scoped_ptr<BeginFrameSourceMultiplexer> frame_source_;
- BeginFrameSource* primary_frame_source_;
- BeginFrameSource* unthrottled_frame_source_;
+ const SchedulerSettings settings_;
+ SchedulerClient* client_;
+ int layer_tree_host_id_;
+ base::SingleThreadTaskRunner* task_runner_;
+ BeginFrameSource* external_frame_source_;
+ scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source_;
+ scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source_;
- // Storage when frame sources are internal
- scoped_ptr<BeginFrameSource> primary_frame_source_internal_;
- scoped_ptr<BeginFrameSource> unthrottled_frame_source_internal_;
+ scoped_ptr<BeginFrameSourceMultiplexer> frame_source_;
+ bool throttle_frame_production_;
- VSyncParameterObserver* vsync_observer_;
base::TimeDelta authoritative_vsync_interval_;
base::TimeTicks last_vsync_timebase_;
- bool throttle_frame_production_;
-
- const SchedulerSettings settings_;
- SchedulerClient* client_;
- int layer_tree_host_id_;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-
base::TimeDelta estimated_parent_draw_time_;
std::deque<BeginFrameArgs> begin_retro_frame_args_;
@@ -252,10 +221,13 @@ class CC_EXPORT Scheduler : public BeginFrameObserverBase {
return inside_action_ == action;
}
- base::WeakPtrFactory<Scheduler> weak_factory_;
+ BeginFrameSource* primary_frame_source() {
+ if (settings_.use_external_begin_frame_source)
mithro-old 2015/06/22 11:49:39 Should you DCHECK external_frame_source_ here?
sunnyps 2015/06/22 20:32:41 Done.
+ return external_frame_source_;
+ return synthetic_frame_source_.get();
+ }
- friend class SchedulerFrameSourcesConstructor;
- friend class TestSchedulerFrameSourcesConstructor;
+ base::WeakPtrFactory<Scheduler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(Scheduler);
};

Powered by Google App Engine
This is Rietveld 408576698