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

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: Add parameter to EndIdlePeriod. 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
« no previous file with comments | « no previous file | content/renderer/scheduler/renderer_scheduler_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d12074e593297ae68342cb4513e8098fb28c5796 100644
--- a/content/renderer/scheduler/renderer_scheduler_impl.h
+++ b/content/renderer/scheduler/renderer_scheduler_impl.h
@@ -111,6 +111,12 @@ 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;
+
+ // The minimum delay to wait between retrying to initiate a long idle time.
+ static const int kRetryInitiateLongIdlePeriodDelayMillis = 1;
+
// IdleTaskDeadlineSupplier Implementation:
void CurrentIdleTaskDeadlineCallback(base::TimeTicks* deadline_out) const;
@@ -127,6 +133,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() const;
+
// 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,9 +151,20 @@ 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,
+ base::TimeDelta* next_long_idle_period_delay_out);
+
+ // Initiate a long idle period.
+ void InitiateLongIdlePeriod();
+ void InitiateLongIdlePeriodAfterWakeup();
+
// Start and end an idle period.
void StartIdlePeriod();
- void EndIdlePeriod();
+ void EndIdlePeriod(bool inhibit_trace_events = false);
Sami 2015/03/05 14:01:04 No default arguments in Chromium :P Also, channeli
picksi 2015/03/05 14:11:32 :)
rmcilroy 2015/03/05 16:07:50 As discussed offline - moved to using an explicit
base::TimeTicks Now() const;
@@ -159,11 +180,15 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler {
base::Closure update_policy_closure_;
CancelableClosureHolder end_idle_period_closure_;
+ CancelableClosureHolder initiate_next_long_idle_period_closure_;
+ CancelableClosureHolder initiate_next_long_idle_period_after_wakeup_closure_;
// Don't access current_policy_ directly, instead use SchedulerPolicy().
Policy current_policy_;
+ bool in_idle_period_;
base::TimeTicks estimated_next_frame_begin_;
+ base::TimeTicks current_policy_expiration_time_;
// The incoming_signals_lock_ mutex protects access to all variables in the
// (contiguous) block below.
« no previous file with comments | « no previous file | content/renderer/scheduler/renderer_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698