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

Side by Side Diff: components/scheduler/renderer/renderer_scheduler_impl.h

Issue 1151353003: [scheduler]: Avoid waking up the scheduler to end long idle periods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@end_idle_sync_2
Patch Set: Fix Win for realz hopefully... 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_
6 #define COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ 6 #define COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_
7 7
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "components/scheduler/child/idle_helper.h" 10 #include "components/scheduler/child/idle_helper.h"
11 #include "components/scheduler/child/pollable_thread_safe_flag.h"
11 #include "components/scheduler/child/scheduler_helper.h" 12 #include "components/scheduler/child/scheduler_helper.h"
12 #include "components/scheduler/renderer/deadline_task_runner.h" 13 #include "components/scheduler/renderer/deadline_task_runner.h"
13 #include "components/scheduler/renderer/renderer_scheduler.h" 14 #include "components/scheduler/renderer/renderer_scheduler.h"
14 #include "components/scheduler/scheduler_export.h" 15 #include "components/scheduler/scheduler_export.h"
15 16
16 namespace base { 17 namespace base {
17 namespace trace_event { 18 namespace trace_event {
18 class ConvertableToTraceFormat; 19 class ConvertableToTraceFormat;
19 } 20 }
20 } 21 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // enum. 85 // enum.
85 enum class InputStreamState { 86 enum class InputStreamState {
86 INACTIVE, 87 INACTIVE,
87 ACTIVE, 88 ACTIVE,
88 ACTIVE_AND_AWAITING_TOUCHSTART_RESPONSE, 89 ACTIVE_AND_AWAITING_TOUCHSTART_RESPONSE,
89 // Must be the last entry. 90 // Must be the last entry.
90 INPUT_STREAM_STATE_COUNT, 91 INPUT_STREAM_STATE_COUNT,
91 FIRST_INPUT_STREAM_STATE = INACTIVE, 92 FIRST_INPUT_STREAM_STATE = INACTIVE,
92 }; 93 };
93 94
94 class PollableNeedsUpdateFlag {
95 public:
96 PollableNeedsUpdateFlag(base::Lock* write_lock);
97 ~PollableNeedsUpdateFlag();
98
99 // Set the flag. May only be called if |write_lock| is held.
100 void SetWhileLocked(bool value);
101
102 // Returns true iff the flag is set to true.
103 bool IsSet() const;
104
105 private:
106 base::subtle::Atomic32 flag_;
107 base::Lock* write_lock_; // Not owned.
108
109 DISALLOW_COPY_AND_ASSIGN(PollableNeedsUpdateFlag);
110 };
111
112 // IdleHelper::Delegate implementation: 95 // IdleHelper::Delegate implementation:
113 bool CanEnterLongIdlePeriod( 96 bool CanEnterLongIdlePeriod(
114 base::TimeTicks now, 97 base::TimeTicks now,
115 base::TimeDelta* next_long_idle_period_delay_out) override; 98 base::TimeDelta* next_long_idle_period_delay_out) override;
116 void IsNotQuiescent() override {} 99 void IsNotQuiescent() override {}
117 100
118 void EndIdlePeriod(); 101 void EndIdlePeriod();
119 102
120 // Returns the serialized scheduler state for tracing. 103 // Returns the serialized scheduler state for tracing.
121 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue( 104 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 188
206 base::TimeTicks estimated_next_frame_begin_; 189 base::TimeTicks estimated_next_frame_begin_;
207 190
208 // The incoming_signals_lock_ mutex protects access to all variables in the 191 // The incoming_signals_lock_ mutex protects access to all variables in the
209 // (contiguous) block below. 192 // (contiguous) block below.
210 mutable base::Lock incoming_signals_lock_; 193 mutable base::Lock incoming_signals_lock_;
211 base::TimeTicks last_input_receipt_time_on_compositor_; 194 base::TimeTicks last_input_receipt_time_on_compositor_;
212 base::TimeTicks last_input_process_time_on_main_; 195 base::TimeTicks last_input_process_time_on_main_;
213 blink::WebInputEvent::Type last_input_type_; 196 blink::WebInputEvent::Type last_input_type_;
214 InputStreamState input_stream_state_; 197 InputStreamState input_stream_state_;
215 PollableNeedsUpdateFlag policy_may_need_update_; 198 PollableThreadSafeFlag policy_may_need_update_;
216 int timer_queue_suspend_count_; // TIMER_TASK_QUEUE suspended if non-zero. 199 int timer_queue_suspend_count_; // TIMER_TASK_QUEUE suspended if non-zero.
217 200
218 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; 201 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_;
219 202
220 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); 203 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl);
221 }; 204 };
222 205
223 } // namespace scheduler 206 } // namespace scheduler
224 207
225 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ 208 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_
OLDNEW
« no previous file with comments | « components/scheduler/child/worker_scheduler_impl_unittest.cc ('k') | components/scheduler/renderer/renderer_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698