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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 MAIN_THREAD_CUSTOM_INPUT_HANDLING, | 56 MAIN_THREAD_CUSTOM_INPUT_HANDLING, |
57 // A continuous gesture (e.g., scroll, pinch) which is being driven by the | 57 // A continuous gesture (e.g., scroll, pinch) which is being driven by the |
58 // compositor thread but also observed by the main thread. An example is | 58 // compositor thread but also observed by the main thread. An example is |
59 // synchronized scrolling where a scroll listener on the main thread changes | 59 // synchronized scrolling where a scroll listener on the main thread changes |
60 // page layout based on the current scroll position. | 60 // page layout based on the current scroll position. |
61 SYNCHRONIZED_GESTURE, | 61 SYNCHRONIZED_GESTURE, |
62 // A gesture has recently started and we are about to run main thread touch | 62 // A gesture has recently started and we are about to run main thread touch |
63 // listeners to find out the actual gesture type. To minimize touch latency, | 63 // listeners to find out the actual gesture type. To minimize touch latency, |
64 // only input handling work should run in this state. | 64 // only input handling work should run in this state. |
65 TOUCHSTART, | 65 TOUCHSTART, |
66 // The page is loading. | 66 // A page is loading. |
67 LOADING, | 67 LOADING, |
68 // A continuous gesture (e.g., scroll) which is being handled by the main | 68 // A continuous gesture (e.g., scroll) which is being handled by the main |
69 // thread. | 69 // thread. |
70 MAIN_THREAD_GESTURE, | 70 MAIN_THREAD_GESTURE, |
71 // Must be the last entry. | 71 // Must be the last entry. |
72 USE_CASE_COUNT, | 72 USE_CASE_COUNT, |
73 FIRST_USE_CASE = NONE, | 73 FIRST_USE_CASE = NONE, |
74 }; | 74 }; |
75 static const char* UseCaseToString(UseCase use_case); | 75 static const char* UseCaseToString(UseCase use_case); |
76 static const char* RAILModeToString(v8::RAILMode rail_mode); | 76 static const char* RAILModeToString(v8::RAILMode rail_mode); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 } | 181 } |
182 | 182 |
183 AutoAdvancingVirtualTimeDomain* GetVirtualTimeDomain(); | 183 AutoAdvancingVirtualTimeDomain* GetVirtualTimeDomain(); |
184 | 184 |
185 TimeDomain* GetActiveTimeDomain(); | 185 TimeDomain* GetActiveTimeDomain(); |
186 | 186 |
187 TaskQueueThrottler* task_queue_throttler() const { | 187 TaskQueueThrottler* task_queue_throttler() const { |
188 return task_queue_throttler_.get(); | 188 return task_queue_throttler_.get(); |
189 } | 189 } |
190 | 190 |
| 191 void OnFirstMeaningfulPaint(); |
| 192 |
191 private: | 193 private: |
192 friend class RendererSchedulerImplTest; | 194 friend class RendererSchedulerImplTest; |
193 friend class RendererSchedulerImplForTest; | 195 friend class RendererSchedulerImplForTest; |
194 friend class RenderWidgetSchedulingState; | 196 friend class RenderWidgetSchedulingState; |
195 | 197 |
196 enum class ExpensiveTaskPolicy { RUN, BLOCK, THROTTLE }; | 198 enum class ExpensiveTaskPolicy { RUN, BLOCK, THROTTLE }; |
197 | 199 |
198 enum class TimeDomainType { | 200 enum class TimeDomainType { |
199 REAL, | 201 REAL, |
200 THROTTLED, | 202 THROTTLED, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValueLocked( | 277 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValueLocked( |
276 base::TimeTicks optional_now) const; | 278 base::TimeTicks optional_now) const; |
277 void CreateTraceEventObjectSnapshotLocked() const; | 279 void CreateTraceEventObjectSnapshotLocked() const; |
278 | 280 |
279 static bool ShouldPrioritizeInputEvent(const WebInputEvent& web_input_event); | 281 static bool ShouldPrioritizeInputEvent(const WebInputEvent& web_input_event); |
280 | 282 |
281 // The amount of time which idle periods can continue being scheduled when the | 283 // The amount of time which idle periods can continue being scheduled when the |
282 // renderer has been hidden, before going to sleep for good. | 284 // renderer has been hidden, before going to sleep for good. |
283 static const int kEndIdleWhenHiddenDelayMillis = 10000; | 285 static const int kEndIdleWhenHiddenDelayMillis = 10000; |
284 | 286 |
285 // The amount of time for which loading tasks will be prioritized over | |
286 // other tasks during the initial page load. | |
287 static const int kRailsInitialLoadingPrioritizationMillis = 1000; | |
288 | |
289 // The amount of time in milliseconds we have to respond to user input as | 287 // The amount of time in milliseconds we have to respond to user input as |
290 // defined by RAILS. | 288 // defined by RAILS. |
291 static const int kRailsResponseTimeMillis = 50; | 289 static const int kRailsResponseTimeMillis = 50; |
292 | 290 |
293 // The amount of time to wait before suspending shared timers after the | 291 // The amount of time to wait before suspending shared timers after the |
294 // renderer has been backgrounded. This is used only if background suspension | 292 // renderer has been backgrounded. This is used only if background suspension |
295 // of shared timers is enabled. | 293 // of shared timers is enabled. |
296 static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000; | 294 static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000; |
297 | 295 |
298 // The time we should stay in a priority-escalated mode after a call to | 296 // The time we should stay in a priority-escalated mode after a call to |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 bool is_audio_playing; | 427 bool is_audio_playing; |
430 std::set<WebViewSchedulerImpl*> web_view_schedulers; // Not owned. | 428 std::set<WebViewSchedulerImpl*> web_view_schedulers; // Not owned. |
431 RAILModeObserver* rail_mode_observer; // Not owned. | 429 RAILModeObserver* rail_mode_observer; // Not owned. |
432 }; | 430 }; |
433 | 431 |
434 struct AnyThread { | 432 struct AnyThread { |
435 AnyThread(); | 433 AnyThread(); |
436 ~AnyThread(); | 434 ~AnyThread(); |
437 | 435 |
438 base::TimeTicks last_idle_period_end_time; | 436 base::TimeTicks last_idle_period_end_time; |
439 base::TimeTicks rails_loading_priority_deadline; | |
440 base::TimeTicks fling_compositor_escalation_deadline; | 437 base::TimeTicks fling_compositor_escalation_deadline; |
441 UserModel user_model; | 438 UserModel user_model; |
442 bool awaiting_touch_start_response; | 439 bool awaiting_touch_start_response; |
443 bool in_idle_period; | 440 bool in_idle_period; |
444 bool begin_main_frame_on_critical_path; | 441 bool begin_main_frame_on_critical_path; |
445 bool last_gesture_was_compositor_driven; | 442 bool last_gesture_was_compositor_driven; |
446 bool default_gesture_prevented; | 443 bool default_gesture_prevented; |
447 bool have_seen_touchstart; | 444 bool have_seen_touchstart; |
| 445 bool waiting_for_meaningful_paint; |
| 446 bool have_seen_input_since_navigation; |
448 }; | 447 }; |
449 | 448 |
450 struct CompositorThreadOnly { | 449 struct CompositorThreadOnly { |
451 CompositorThreadOnly(); | 450 CompositorThreadOnly(); |
452 ~CompositorThreadOnly(); | 451 ~CompositorThreadOnly(); |
453 | 452 |
454 WebInputEvent::Type last_input_type; | 453 WebInputEvent::Type last_input_type; |
455 std::unique_ptr<base::ThreadChecker> compositor_thread_checker; | 454 std::unique_ptr<base::ThreadChecker> compositor_thread_checker; |
456 | 455 |
457 void CheckOnValidThread() { | 456 void CheckOnValidThread() { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 PollableThreadSafeFlag policy_may_need_update_; | 497 PollableThreadSafeFlag policy_may_need_update_; |
499 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; | 498 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
500 | 499 |
501 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); | 500 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); |
502 }; | 501 }; |
503 | 502 |
504 } // namespace scheduler | 503 } // namespace scheduler |
505 } // namespace blink | 504 } // namespace blink |
506 | 505 |
507 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU
LER_IMPL_H_ | 506 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU
LER_IMPL_H_ |
OLD | NEW |