Chromium Code Reviews

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h

Issue 2397753006: scheduler: Detect load RAIL mode (Closed)
Patch Set: Rebased Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 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...)
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 94 matching lines...)
171 RealTimeDomain* real_time_domain() const { 171 RealTimeDomain* real_time_domain() const {
172 return helper_.real_time_domain(); 172 return helper_.real_time_domain();
173 } 173 }
174 174
175 AutoAdvancingVirtualTimeDomain* GetVirtualTimeDomain(); 175 AutoAdvancingVirtualTimeDomain* GetVirtualTimeDomain();
176 176
177 TaskQueueThrottler* task_queue_throttler() const { 177 TaskQueueThrottler* task_queue_throttler() const {
178 return task_queue_throttler_.get(); 178 return task_queue_throttler_.get();
179 } 179 }
180 180
181 void OnFirstMeaningfulPaint();
182
181 private: 183 private:
182 friend class RendererSchedulerImplTest; 184 friend class RendererSchedulerImplTest;
183 friend class RendererSchedulerImplForTest; 185 friend class RendererSchedulerImplForTest;
184 friend class RenderWidgetSchedulingState; 186 friend class RenderWidgetSchedulingState;
185 187
186 enum class ExpensiveTaskPolicy { RUN, BLOCK, THROTTLE }; 188 enum class ExpensiveTaskPolicy { RUN, BLOCK, THROTTLE };
187 189
188 enum class TimeDomainType { 190 enum class TimeDomainType {
189 REAL, 191 REAL,
190 THROTTLED, 192 THROTTLED,
(...skipping 66 matching lines...)
257 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValueLocked( 259 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValueLocked(
258 base::TimeTicks optional_now) const; 260 base::TimeTicks optional_now) const;
259 void CreateTraceEventObjectSnapshotLocked() const; 261 void CreateTraceEventObjectSnapshotLocked() const;
260 262
261 static bool ShouldPrioritizeInputEvent(const WebInputEvent& web_input_event); 263 static bool ShouldPrioritizeInputEvent(const WebInputEvent& web_input_event);
262 264
263 // The amount of time which idle periods can continue being scheduled when the 265 // The amount of time which idle periods can continue being scheduled when the
264 // renderer has been hidden, before going to sleep for good. 266 // renderer has been hidden, before going to sleep for good.
265 static const int kEndIdleWhenHiddenDelayMillis = 10000; 267 static const int kEndIdleWhenHiddenDelayMillis = 10000;
266 268
267 // The amount of time for which loading tasks will be prioritized over
268 // other tasks during the initial page load.
269 static const int kRailsInitialLoadingPrioritizationMillis = 1000;
270
271 // The amount of time in milliseconds we have to respond to user input as 269 // The amount of time in milliseconds we have to respond to user input as
272 // defined by RAILS. 270 // defined by RAILS.
273 static const int kRailsResponseTimeMillis = 50; 271 static const int kRailsResponseTimeMillis = 50;
274 272
275 // The amount of time to wait before suspending shared timers after the 273 // The amount of time to wait before suspending shared timers after the
276 // renderer has been backgrounded. This is used only if background suspension 274 // renderer has been backgrounded. This is used only if background suspension
277 // of shared timers is enabled. 275 // of shared timers is enabled.
278 static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000; 276 static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000;
279 277
280 // The time we should stay in a priority-escalated mode after a call to 278 // The time we should stay in a priority-escalated mode after a call to
(...skipping 126 matching lines...)
407 bool use_virtual_time; 405 bool use_virtual_time;
408 std::set<WebViewSchedulerImpl*> web_view_schedulers; // Not owned. 406 std::set<WebViewSchedulerImpl*> web_view_schedulers; // Not owned.
409 RAILModeObserver* rail_mode_observer; // Not owned. 407 RAILModeObserver* rail_mode_observer; // Not owned.
410 }; 408 };
411 409
412 struct AnyThread { 410 struct AnyThread {
413 AnyThread(); 411 AnyThread();
414 ~AnyThread(); 412 ~AnyThread();
415 413
416 base::TimeTicks last_idle_period_end_time; 414 base::TimeTicks last_idle_period_end_time;
417 base::TimeTicks rails_loading_priority_deadline;
418 base::TimeTicks fling_compositor_escalation_deadline; 415 base::TimeTicks fling_compositor_escalation_deadline;
419 UserModel user_model; 416 UserModel user_model;
420 bool awaiting_touch_start_response; 417 bool awaiting_touch_start_response;
421 bool in_idle_period; 418 bool in_idle_period;
422 bool begin_main_frame_on_critical_path; 419 bool begin_main_frame_on_critical_path;
423 bool last_gesture_was_compositor_driven; 420 bool last_gesture_was_compositor_driven;
424 bool default_gesture_prevented; 421 bool default_gesture_prevented;
425 bool have_seen_touchstart; 422 bool have_seen_touchstart;
423 bool waiting_for_meaningful_paint;
426 }; 424 };
427 425
428 struct CompositorThreadOnly { 426 struct CompositorThreadOnly {
429 CompositorThreadOnly(); 427 CompositorThreadOnly();
430 ~CompositorThreadOnly(); 428 ~CompositorThreadOnly();
431 429
432 WebInputEvent::Type last_input_type; 430 WebInputEvent::Type last_input_type;
433 std::unique_ptr<base::ThreadChecker> compositor_thread_checker; 431 std::unique_ptr<base::ThreadChecker> compositor_thread_checker;
434 432
435 void CheckOnValidThread() { 433 void CheckOnValidThread() {
(...skipping 40 matching lines...)
476 PollableThreadSafeFlag policy_may_need_update_; 474 PollableThreadSafeFlag policy_may_need_update_;
477 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; 475 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_;
478 476
479 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); 477 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl);
480 }; 478 };
481 479
482 } // namespace scheduler 480 } // namespace scheduler
483 } // namespace blink 481 } // namespace blink
484 482
485 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU LER_IMPL_H_ 483 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU LER_IMPL_H_
OLDNEW

Powered by Google App Engine