| 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDULER
_IMPL_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDULER
_IMPL_H_ |
| 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDULER
_IMPL_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDULER
_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/atomicops.h" | 8 #include "base/atomicops.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 static const int kEndIdleWhenHiddenDelayMillis = 10000; | 258 static const int kEndIdleWhenHiddenDelayMillis = 10000; |
| 259 | 259 |
| 260 // The amount of time for which loading tasks will be prioritized over | 260 // The amount of time for which loading tasks will be prioritized over |
| 261 // other tasks during the initial page load. | 261 // other tasks during the initial page load. |
| 262 static const int kRailsInitialLoadingPrioritizationMillis = 1000; | 262 static const int kRailsInitialLoadingPrioritizationMillis = 1000; |
| 263 | 263 |
| 264 // The amount of time in milliseconds we have to respond to user input as | 264 // The amount of time in milliseconds we have to respond to user input as |
| 265 // defined by RAILS. | 265 // defined by RAILS. |
| 266 static const int kRailsResponseTimeMillis = 50; | 266 static const int kRailsResponseTimeMillis = 50; |
| 267 | 267 |
| 268 // For the purposes of deciding whether or not it's safe to turn timers and | |
| 269 // loading tasks on only in idle periods, we regard the system as being as | |
| 270 // being "idle period" starved if there hasn't been an idle period in the last | |
| 271 // 10 seconds. This was chosen to be long enough to cover most anticipated | |
| 272 // user gestures. | |
| 273 static const int kIdlePeriodStarvationThresholdMillis = 10000; | |
| 274 | |
| 275 // The amount of time to wait before suspending shared timers after the | 268 // The amount of time to wait before suspending shared timers after the |
| 276 // renderer has been backgrounded. This is used only if background suspension | 269 // renderer has been backgrounded. This is used only if background suspension |
| 277 // of shared timers is enabled. | 270 // of shared timers is enabled. |
| 278 static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000; | 271 static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000; |
| 279 | 272 |
| 280 // The time we should stay in a priority-escalated mode after a call to | 273 // The time we should stay in a priority-escalated mode after a call to |
| 281 // DidAnimateForInputOnCompositorThread(). | 274 // DidAnimateForInputOnCompositorThread(). |
| 282 static const int kFlingEscalationLimitMillis = 100; | 275 static const int kFlingEscalationLimitMillis = 100; |
| 283 | 276 |
| 284 // Schedules an immediate PolicyUpdate, if there isn't one already pending and | 277 // Schedules an immediate PolicyUpdate, if there isn't one already pending and |
| (...skipping 28 matching lines...) Expand all Loading... |
| 313 // scheduled. Must be called with |any_thread_lock_| held. Can be called from | 306 // scheduled. Must be called with |any_thread_lock_| held. Can be called from |
| 314 // any thread. | 307 // any thread. |
| 315 UseCase ComputeCurrentUseCase( | 308 UseCase ComputeCurrentUseCase( |
| 316 base::TimeTicks now, | 309 base::TimeTicks now, |
| 317 base::TimeDelta* expected_use_case_duration) const; | 310 base::TimeDelta* expected_use_case_duration) const; |
| 318 | 311 |
| 319 // An input event of some sort happened, the policy may need updating. | 312 // An input event of some sort happened, the policy may need updating. |
| 320 void UpdateForInputEventOnCompositorThread(WebInputEvent::Type type, | 313 void UpdateForInputEventOnCompositorThread(WebInputEvent::Type type, |
| 321 InputEventState input_event_state); | 314 InputEventState input_event_state); |
| 322 | 315 |
| 323 // Returns true if there has been at least one idle period in the last | |
| 324 // |kIdlePeriodStarvationThresholdMillis|. | |
| 325 bool HadAnIdlePeriodRecently(base::TimeTicks now) const; | |
| 326 | |
| 327 // Helpers for safely suspending/resuming the timer queue after a | 316 // Helpers for safely suspending/resuming the timer queue after a |
| 328 // background/foreground signal. | 317 // background/foreground signal. |
| 329 void SuspendTimerQueueWhenBackgrounded(); | 318 void SuspendTimerQueueWhenBackgrounded(); |
| 330 void ResumeTimerQueueWhenForegrounded(); | 319 void ResumeTimerQueueWhenForegrounded(); |
| 331 | 320 |
| 332 // The task cost estimators and the UserModel need to be reset upon page | 321 // The task cost estimators and the UserModel need to be reset upon page |
| 333 // nagigation. This function does that. Must be called from the main thread. | 322 // nagigation. This function does that. Must be called from the main thread. |
| 334 void ResetForNavigationLocked(); | 323 void ResetForNavigationLocked(); |
| 335 | 324 |
| 336 // Estimates the maximum task length that won't cause a jank based on the | 325 // Estimates the maximum task length that won't cause a jank based on the |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 PollableThreadSafeFlag policy_may_need_update_; | 467 PollableThreadSafeFlag policy_may_need_update_; |
| 479 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; | 468 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
| 480 | 469 |
| 481 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); | 470 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); |
| 482 }; | 471 }; |
| 483 | 472 |
| 484 } // namespace scheduler | 473 } // namespace scheduler |
| 485 } // namespace blink | 474 } // namespace blink |
| 486 | 475 |
| 487 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU
LER_IMPL_H_ | 476 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU
LER_IMPL_H_ |
| OLD | NEW |