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

Unified Diff: content/renderer/scheduler/renderer_scheduler_impl.h

Issue 968073003: [content]: Add support for long idle times in the Blink Scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@long_idle_4
Patch Set: Minor tweaks Created 5 years, 10 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: content/renderer/scheduler/renderer_scheduler_impl.h
diff --git a/content/renderer/scheduler/renderer_scheduler_impl.h b/content/renderer/scheduler/renderer_scheduler_impl.h
index c908a974a0d8f21cf24f8cb34d36fc053a1d68c8..fcf236904d1165cfd37161b239b16e68a77f988f 100644
--- a/content/renderer/scheduler/renderer_scheduler_impl.h
+++ b/content/renderer/scheduler/renderer_scheduler_impl.h
@@ -111,6 +111,9 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler {
// The time we should stay in a priority-escalated mode after an input event.
static const int kPriorityEscalationAfterInputMillis = 100;
+ // The maximum length of an idle period.
+ static const int kMaximumIdlePeriodMillis = 50;
+
// IdleTaskDeadlineSupplier Implementation:
void CurrentIdleTaskDeadlineCallback(base::TimeTicks* deadline_out) const;
@@ -127,6 +130,10 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler {
// Updates the scheduler policy. Must be called from the main thread.
void UpdatePolicy();
+ // Returns the amount of time left in the current input escalated priority
+ // policy.
+ base::TimeDelta TimeLeftInInputEscalatedPolicy();
Sami 2015/03/03 16:55:36 Can this be const?
rmcilroy 2015/03/04 14:23:12 Yes - done.
+
// Helper for computing the new policy. |new_policy_duration| will be filled
// with the amount of time after which the policy should be updated again. If
// the duration is zero, a new policy update will not be scheduled. Must be
@@ -141,6 +148,17 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler {
// input was processed.
void DidProcessInputEvent(base::TimeTicks begin_frame_time);
+ // Returns true if we should initiate a long idle time now. Fills in
+ // |next_long_idle_period_delay_out| with the next time we should try to
+ // initiate the next idle period.
+ bool ShouldStartLongIdlePeriod(
+ const base::TimeTicks& now,
Sami 2015/03/03 16:55:36 nit: pass TimeTicks by value.
rmcilroy 2015/03/04 14:23:12 Done.
+ base::TimeDelta* next_long_idle_period_delay_out);
+
+ // Initiate a long idle period.
+ void InitiateLongIdlePeriod();
+ void AfterWakeupInitiateLongIdlePeriod();
Sami 2015/03/03 16:55:36 InitiateLongIdlePeriodAfterWakeup to make this les
rmcilroy 2015/03/04 14:23:12 mmh, I originally had this but thought it sounded
rmcilroy 2015/03/04 14:23:12 Done.
+
// Start and end an idle period.
void StartIdlePeriod();
void EndIdlePeriod();
@@ -159,6 +177,8 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler {
base::Closure update_policy_closure_;
CancelableClosureHolder end_idle_period_closure_;
+ CancelableClosureHolder initiate_next_long_idle_period_closure_;
+ CancelableClosureHolder after_wakeup_initiate_next_long_idle_period_closure_;
// Don't access current_policy_ directly, instead use SchedulerPolicy().
Policy current_policy_;

Powered by Google App Engine
This is Rietveld 408576698