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

Unified Diff: cc/scheduler/scheduler.h

Issue 554973002: Disable scheduler deadline task on battery power in Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address brianderson's and mithro's comments Created 6 years, 2 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 | « no previous file | 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 2ef10a481ddebc38d8dd04dd3127f911a0285bdd..9ae7671bc321e2fabfd16c942288e9e27742d2d3 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -11,6 +11,8 @@
#include "base/basictypes.h"
#include "base/cancelable_callback.h"
#include "base/memory/scoped_ptr.h"
+#include "base/power_monitor/power_monitor.h"
+#include "base/power_monitor/power_observer.h"
#include "base/time/time.h"
#include "cc/base/cc_export.h"
#include "cc/output/begin_frame_args.h"
@@ -71,7 +73,8 @@ class CC_EXPORT SchedulerFrameSourcesConstructor {
friend class Scheduler;
};
-class CC_EXPORT Scheduler : public BeginFrameObserverMixIn {
+class CC_EXPORT Scheduler : public BeginFrameObserverMixIn,
+ public base::PowerObserver {
public:
static scoped_ptr<Scheduler> Create(
SchedulerClient* client,
@@ -83,11 +86,15 @@ class CC_EXPORT Scheduler : public BeginFrameObserverMixIn {
scheduler_settings,
layer_tree_host_id,
task_runner,
- &frame_sources_constructor));
+ &frame_sources_constructor,
+ base::PowerMonitor::Get()));
danakj 2014/10/15 15:42:26 I think brian meant that you'd pass it to Create()
}
virtual ~Scheduler();
+ // base::PowerObserver method.
+ virtual void OnPowerStateChange(bool on_battery_power) override;
+
const SchedulerSettings& settings() const { return settings_; }
void CommitVSyncParameters(base::TimeTicks timebase,
@@ -164,7 +171,8 @@ class CC_EXPORT Scheduler : public BeginFrameObserverMixIn {
const SchedulerSettings& scheduler_settings,
int layer_tree_host_id,
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
- SchedulerFrameSourcesConstructor* frame_sources_constructor);
+ SchedulerFrameSourcesConstructor* frame_sources_constructor,
+ base::PowerMonitor* power_monitor);
// virtual for testing - Don't call these in the constructor or
// destructor!
@@ -185,6 +193,8 @@ class CC_EXPORT Scheduler : public BeginFrameObserverMixIn {
int layer_tree_host_id_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ base::PowerMonitor* power_monitor_;
+
base::TimeDelta estimated_parent_draw_time_;
bool begin_retro_frame_posted_;
@@ -223,6 +233,8 @@ class CC_EXPORT Scheduler : public BeginFrameObserverMixIn {
void OnBeginImplFrameDeadline();
void PollForAnticipatedDrawTriggers();
void PollToAdvanceCommitState();
+ void SetupPowerMonitoring();
+ void TeardownPowerMonitoring();
base::TimeDelta EstimatedParentDrawTime() {
return estimated_parent_draw_time_;
« no previous file with comments | « no previous file | cc/scheduler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698