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

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

Issue 969373002: [content]: Add CanExceedIdleDeadlineIfRequired function to RendererScheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@long_idle_5
Patch Set: Change to exposing a CanExceedIdleDeadlineIfRequired function instead. 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 3b21599e38a4c13b30d73c27a26061f89991458d..33e564f87745aa40cdf497310c025d327f02d81e 100644
--- a/content/renderer/scheduler/renderer_scheduler_impl.h
+++ b/content/renderer/scheduler/renderer_scheduler_impl.h
@@ -41,6 +41,7 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler {
void DidReceiveInputEventOnCompositorThread(
const blink::WebInputEvent& web_input_event) override;
void DidAnimateForInputOnCompositorThread() override;
+ bool CanExceedIdleDeadlineIfRequired() const override;
bool IsHighPriorityWorkAnticipated() override;
bool ShouldYieldForHighPriorityWork() override;
void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override;
@@ -78,6 +79,12 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler {
ACTIVE_AND_AWAITING_TOUCHSTART_RESPONSE
};
+ enum class IdlePeriodState {
+ NOT_WITHIN_IDLE_PERIOD,
+ WITHIN_IDLE_PERIOD,
+ WITHIN_MAX_DEADLINE_IDLE_PERIOD
+ };
+
class PollableNeedsUpdateFlag {
public:
PollableNeedsUpdateFlag(base::Lock* write_lock);
@@ -151,19 +158,19 @@ 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
+ // Returns the new idle period state for the next long idle period. Fills in
// |next_long_idle_period_delay_out| with the next time we should try to
// initiate the next idle period.
- bool ShouldStartLongIdlePeriod(
+ IdlePeriodState ComputeNewLongIdlePeriodState(
const base::TimeTicks now,
- base::TimeDelta* next_long_idle_period_delay_out);
+ base::TimeDelta* next_long_idle_period_delay);
Sami 2015/03/05 11:59:33 Did you mean to drop the _out here? It's still ref
rmcilroy 2015/03/05 13:50:19 opps no, thanks.
// Initiate a long idle period.
void InitiateLongIdlePeriod();
void InitiateLongIdlePeriodAfterWakeup();
// Start and end an idle period.
- void StartIdlePeriod();
+ void StartIdlePeriod(IdlePeriodState new_idle_period_state);
void EndIdlePeriod();
base::TimeTicks Now() const;
@@ -185,7 +192,7 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler {
// Don't access current_policy_ directly, instead use SchedulerPolicy().
Policy current_policy_;
- bool in_idle_period_;
+ IdlePeriodState idle_period_state_;
Sami 2015/03/05 11:59:33 Not initialized?
rmcilroy 2015/03/05 13:50:19 Done.
base::TimeTicks estimated_next_frame_begin_;
base::TimeTicks current_policy_expiration_time_;

Powered by Google App Engine
This is Rietveld 408576698