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

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 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 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 MAIN_THREAD_CUSTOM_INPUT_HANDLING, 58 MAIN_THREAD_CUSTOM_INPUT_HANDLING,
59 // A continuous gesture (e.g., scroll, pinch) which is being driven by the 59 // A continuous gesture (e.g., scroll, pinch) which is being driven by the
60 // compositor thread but also observed by the main thread. An example is 60 // compositor thread but also observed by the main thread. An example is
61 // synchronized scrolling where a scroll listener on the main thread changes 61 // synchronized scrolling where a scroll listener on the main thread changes
62 // page layout based on the current scroll position. 62 // page layout based on the current scroll position.
63 SYNCHRONIZED_GESTURE, 63 SYNCHRONIZED_GESTURE,
64 // A gesture has recently started and we are about to run main thread touch 64 // A gesture has recently started and we are about to run main thread touch
65 // listeners to find out the actual gesture type. To minimize touch latency, 65 // listeners to find out the actual gesture type. To minimize touch latency,
66 // only input handling work should run in this state. 66 // only input handling work should run in this state.
67 TOUCHSTART, 67 TOUCHSTART,
68 // The page is loading. 68 // A page is loading.
69 LOADING, 69 LOADING,
70 // A continuous gesture (e.g., scroll) which is being handled by the main 70 // A continuous gesture (e.g., scroll) which is being handled by the main
71 // thread. 71 // thread.
72 MAIN_THREAD_GESTURE, 72 MAIN_THREAD_GESTURE,
73 // Must be the last entry. 73 // Must be the last entry.
74 USE_CASE_COUNT, 74 USE_CASE_COUNT,
75 FIRST_USE_CASE = NONE, 75 FIRST_USE_CASE = NONE,
76 }; 76 };
77 static const char* UseCaseToString(UseCase use_case); 77 static const char* UseCaseToString(UseCase use_case);
78 static const char* RAILModeToString(v8::RAILMode rail_mode); 78 static const char* RAILModeToString(v8::RAILMode rail_mode);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 AutoAdvancingVirtualTimeDomain* GetVirtualTimeDomain(); 185 AutoAdvancingVirtualTimeDomain* GetVirtualTimeDomain();
186 186
187 TimeDomain* GetActiveTimeDomain(); 187 TimeDomain* GetActiveTimeDomain();
188 188
189 TaskQueueThrottler* task_queue_throttler() const { 189 TaskQueueThrottler* task_queue_throttler() const {
190 return task_queue_throttler_.get(); 190 return task_queue_throttler_.get();
191 } 191 }
192 192
193 void OnFirstMeaningfulPaint();
194
193 // base::trace_event::TraceLog::EnabledStateObserver implementation: 195 // base::trace_event::TraceLog::EnabledStateObserver implementation:
194 void OnTraceLogEnabled() override; 196 void OnTraceLogEnabled() override;
195 void OnTraceLogDisabled() override; 197 void OnTraceLogDisabled() override;
196 198
197 private: 199 private:
198 friend class RendererSchedulerImplTest; 200 friend class RendererSchedulerImplTest;
199 friend class RendererSchedulerImplForTest; 201 friend class RendererSchedulerImplForTest;
200 friend class RenderWidgetSchedulingState; 202 friend class RenderWidgetSchedulingState;
201 203
202 enum class ExpensiveTaskPolicy { RUN, BLOCK, THROTTLE }; 204 enum class ExpensiveTaskPolicy { RUN, BLOCK, THROTTLE };
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValueLocked( 283 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValueLocked(
282 base::TimeTicks optional_now) const; 284 base::TimeTicks optional_now) const;
283 void CreateTraceEventObjectSnapshotLocked() const; 285 void CreateTraceEventObjectSnapshotLocked() const;
284 286
285 static bool ShouldPrioritizeInputEvent(const WebInputEvent& web_input_event); 287 static bool ShouldPrioritizeInputEvent(const WebInputEvent& web_input_event);
286 288
287 // The amount of time which idle periods can continue being scheduled when the 289 // The amount of time which idle periods can continue being scheduled when the
288 // renderer has been hidden, before going to sleep for good. 290 // renderer has been hidden, before going to sleep for good.
289 static const int kEndIdleWhenHiddenDelayMillis = 10000; 291 static const int kEndIdleWhenHiddenDelayMillis = 10000;
290 292
291 // The amount of time for which loading tasks will be prioritized over
292 // other tasks during the initial page load.
293 static const int kRailsInitialLoadingPrioritizationMillis = 1000;
294
295 // The amount of time in milliseconds we have to respond to user input as 293 // The amount of time in milliseconds we have to respond to user input as
296 // defined by RAILS. 294 // defined by RAILS.
297 static const int kRailsResponseTimeMillis = 50; 295 static const int kRailsResponseTimeMillis = 50;
298 296
299 // The amount of time to wait before suspending shared timers after the 297 // The amount of time to wait before suspending shared timers after the
300 // renderer has been backgrounded. This is used only if background suspension 298 // renderer has been backgrounded. This is used only if background suspension
301 // of shared timers is enabled. 299 // of shared timers is enabled.
302 static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000; 300 static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000;
303 301
304 // The time we should stay in a priority-escalated mode after a call to 302 // The time we should stay in a priority-escalated mode after a call to
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 bool is_audio_playing; 442 bool is_audio_playing;
445 std::set<WebViewSchedulerImpl*> web_view_schedulers; // Not owned. 443 std::set<WebViewSchedulerImpl*> web_view_schedulers; // Not owned.
446 RAILModeObserver* rail_mode_observer; // Not owned. 444 RAILModeObserver* rail_mode_observer; // Not owned.
447 }; 445 };
448 446
449 struct AnyThread { 447 struct AnyThread {
450 AnyThread(); 448 AnyThread();
451 ~AnyThread(); 449 ~AnyThread();
452 450
453 base::TimeTicks last_idle_period_end_time; 451 base::TimeTicks last_idle_period_end_time;
454 base::TimeTicks rails_loading_priority_deadline;
455 base::TimeTicks fling_compositor_escalation_deadline; 452 base::TimeTicks fling_compositor_escalation_deadline;
456 UserModel user_model; 453 UserModel user_model;
457 bool awaiting_touch_start_response; 454 bool awaiting_touch_start_response;
458 bool in_idle_period; 455 bool in_idle_period;
459 bool begin_main_frame_on_critical_path; 456 bool begin_main_frame_on_critical_path;
460 bool last_gesture_was_compositor_driven; 457 bool last_gesture_was_compositor_driven;
461 bool default_gesture_prevented; 458 bool default_gesture_prevented;
462 bool have_seen_touchstart; 459 bool have_seen_touchstart;
460 bool waiting_for_meaningful_paint;
461 bool have_seen_input_since_navigation;
463 }; 462 };
464 463
465 struct CompositorThreadOnly { 464 struct CompositorThreadOnly {
466 CompositorThreadOnly(); 465 CompositorThreadOnly();
467 ~CompositorThreadOnly(); 466 ~CompositorThreadOnly();
468 467
469 WebInputEvent::Type last_input_type; 468 WebInputEvent::Type last_input_type;
470 std::unique_ptr<base::ThreadChecker> compositor_thread_checker; 469 std::unique_ptr<base::ThreadChecker> compositor_thread_checker;
471 470
472 void CheckOnValidThread() { 471 void CheckOnValidThread() {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 PollableThreadSafeFlag policy_may_need_update_; 512 PollableThreadSafeFlag policy_may_need_update_;
514 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; 513 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_;
515 514
516 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); 515 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl);
517 }; 516 };
518 517
519 } // namespace scheduler 518 } // namespace scheduler
520 } // namespace blink 519 } // namespace blink
521 520
522 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU LER_IMPL_H_ 521 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU LER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698