Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 void DidHandleInputEventOnCompositorThread( | 43 void DidHandleInputEventOnCompositorThread( |
| 44 const blink::WebInputEvent& web_input_event, | 44 const blink::WebInputEvent& web_input_event, |
| 45 InputEventState event_state) override; | 45 InputEventState event_state) override; |
| 46 void DidHandleInputEventOnMainThread( | 46 void DidHandleInputEventOnMainThread( |
| 47 const blink::WebInputEvent& web_input_event) override; | 47 const blink::WebInputEvent& web_input_event) override; |
| 48 void DidAnimateForInputOnCompositorThread() override; | 48 void DidAnimateForInputOnCompositorThread() override; |
| 49 void OnRendererHidden() override; | 49 void OnRendererHidden() override; |
| 50 void OnRendererVisible() override; | 50 void OnRendererVisible() override; |
| 51 void OnRendererBackgrounded() override; | 51 void OnRendererBackgrounded() override; |
| 52 void OnRendererForegrounded() override; | 52 void OnRendererForegrounded() override; |
| 53 void OnPageLoadStarted() override; | 53 void OnNavigationExpected() override; |
| 54 void OnNavigationCanceled() override; | |
| 55 void OnNavigationStarted() override; | |
| 54 bool IsHighPriorityWorkAnticipated() override; | 56 bool IsHighPriorityWorkAnticipated() override; |
| 55 bool ShouldYieldForHighPriorityWork() override; | 57 bool ShouldYieldForHighPriorityWork() override; |
| 56 bool CanExceedIdleDeadlineIfRequired() const override; | 58 bool CanExceedIdleDeadlineIfRequired() const override; |
| 57 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override; | 59 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override; |
| 58 void RemoveTaskObserver( | 60 void RemoveTaskObserver( |
| 59 base::MessageLoop::TaskObserver* task_observer) override; | 61 base::MessageLoop::TaskObserver* task_observer) override; |
| 60 void Shutdown() override; | 62 void Shutdown() override; |
| 61 void SuspendTimerQueue() override; | 63 void SuspendTimerQueue() override; |
| 62 void ResumeTimerQueue() override; | 64 void ResumeTimerQueue() override; |
| 63 void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) override; | 65 void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) override; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 const blink::WebInputEvent& web_input_event); | 128 const blink::WebInputEvent& web_input_event); |
| 127 | 129 |
| 128 // The amount of time which idle periods can continue being scheduled when the | 130 // The amount of time which idle periods can continue being scheduled when the |
| 129 // renderer has been hidden, before going to sleep for good. | 131 // renderer has been hidden, before going to sleep for good. |
| 130 static const int kEndIdleWhenHiddenDelayMillis = 10000; | 132 static const int kEndIdleWhenHiddenDelayMillis = 10000; |
| 131 | 133 |
| 132 // The amount of time for which loading tasks will be prioritized over | 134 // The amount of time for which loading tasks will be prioritized over |
| 133 // other tasks during the initial page load. | 135 // other tasks during the initial page load. |
| 134 static const int kRailsInitialLoadingPrioritizationMillis = 1000; | 136 static const int kRailsInitialLoadingPrioritizationMillis = 1000; |
| 135 | 137 |
| 138 // The maximum amount of time to wait for a OnNavigationStarted after a | |
| 139 // OnPageLoadExpected. | |
|
Sami
2015/09/24 14:15:04
s/PageLoad/Navigation/ (in the variable name too)
alex clarke (OOO till 29th)
2015/09/24 14:53:10
I don't need this constant anymore.
| |
| 140 static const int kMaxPageLoadExpectedWaitMillis = 2000; | |
| 141 | |
| 136 // For the purposes of deciding whether or not it's safe to turn timers and | 142 // For the purposes of deciding whether or not it's safe to turn timers and |
| 137 // loading tasks on only in idle periods, we regard the system as being as | 143 // loading tasks on only in idle periods, we regard the system as being as |
| 138 // being "idle period" starved if there hasn't been an idle period in the last | 144 // being "idle period" starved if there hasn't been an idle period in the last |
| 139 // 10 seconds. This was chosen to be long enough to cover most anticipated | 145 // 10 seconds. This was chosen to be long enough to cover most anticipated |
| 140 // user gestures. | 146 // user gestures. |
| 141 static const int kIdlePeriodStarvationThresholdMillis = 10000; | 147 static const int kIdlePeriodStarvationThresholdMillis = 10000; |
| 142 | 148 |
| 143 // The amount of time to wait before suspending shared timers after the | 149 // The amount of time to wait before suspending shared timers after the |
| 144 // renderer has been backgrounded. This is used only if background suspension | 150 // renderer has been backgrounded. This is used only if background suspension |
| 145 // of shared timers is enabled. | 151 // of shared timers is enabled. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 bool touchstart_expected_soon; | 246 bool touchstart_expected_soon; |
| 241 bool have_seen_a_begin_main_frame; | 247 bool have_seen_a_begin_main_frame; |
| 242 }; | 248 }; |
| 243 | 249 |
| 244 struct AnyThread { | 250 struct AnyThread { |
| 245 AnyThread(); | 251 AnyThread(); |
| 246 | 252 |
| 247 base::TimeTicks last_idle_period_end_time; | 253 base::TimeTicks last_idle_period_end_time; |
| 248 base::TimeTicks rails_loading_priority_deadline; | 254 base::TimeTicks rails_loading_priority_deadline; |
| 249 UserModel user_model; | 255 UserModel user_model; |
| 256 bool navigation_expected; | |
|
Sami
2015/09/24 14:15:04
Should this on the main thread struct instead? I t
alex clarke (OOO till 29th)
2015/09/24 14:53:10
Done.
| |
| 250 bool awaiting_touch_start_response; | 257 bool awaiting_touch_start_response; |
| 251 bool in_idle_period; | 258 bool in_idle_period; |
| 252 bool begin_main_frame_on_critical_path; | 259 bool begin_main_frame_on_critical_path; |
| 253 }; | 260 }; |
| 254 | 261 |
| 255 struct CompositorThreadOnly { | 262 struct CompositorThreadOnly { |
| 256 CompositorThreadOnly(); | 263 CompositorThreadOnly(); |
| 257 ~CompositorThreadOnly(); | 264 ~CompositorThreadOnly(); |
| 258 | 265 |
| 259 blink::WebInputEvent::Type last_input_type; | 266 blink::WebInputEvent::Type last_input_type; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 | 309 |
| 303 PollableThreadSafeFlag policy_may_need_update_; | 310 PollableThreadSafeFlag policy_may_need_update_; |
| 304 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; | 311 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
| 305 | 312 |
| 306 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); | 313 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); |
| 307 }; | 314 }; |
| 308 | 315 |
| 309 } // namespace scheduler | 316 } // namespace scheduler |
| 310 | 317 |
| 311 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ | 318 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ |
| OLD | NEW |