| 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" |
| 11 #include "platform/scheduler/base/long_task_tracker.h" | |
| 12 #include "platform/scheduler/base/pollable_thread_safe_flag.h" | 11 #include "platform/scheduler/base/pollable_thread_safe_flag.h" |
| 13 #include "platform/scheduler/base/queueing_time_estimator.h" | 12 #include "platform/scheduler/base/queueing_time_estimator.h" |
| 14 #include "platform/scheduler/base/task_time_tracker.h" | |
| 15 #include "platform/scheduler/child/idle_helper.h" | 13 #include "platform/scheduler/child/idle_helper.h" |
| 16 #include "platform/scheduler/child/scheduler_helper.h" | 14 #include "platform/scheduler/child/scheduler_helper.h" |
| 17 #include "platform/scheduler/renderer/deadline_task_runner.h" | 15 #include "platform/scheduler/renderer/deadline_task_runner.h" |
| 18 #include "platform/scheduler/renderer/idle_time_estimator.h" | 16 #include "platform/scheduler/renderer/idle_time_estimator.h" |
| 19 #include "platform/scheduler/renderer/render_widget_signals.h" | 17 #include "platform/scheduler/renderer/render_widget_signals.h" |
| 20 #include "public/platform/scheduler/renderer/renderer_scheduler.h" | |
| 21 #include "platform/scheduler/renderer/task_cost_estimator.h" | 18 #include "platform/scheduler/renderer/task_cost_estimator.h" |
| 22 #include "platform/scheduler/renderer/throttling_helper.h" | 19 #include "platform/scheduler/renderer/throttling_helper.h" |
| 23 #include "platform/scheduler/renderer/user_model.h" | 20 #include "platform/scheduler/renderer/user_model.h" |
| 24 #include "platform/scheduler/renderer/web_view_scheduler_impl.h" | 21 #include "platform/scheduler/renderer/web_view_scheduler_impl.h" |
| 22 #include "public/platform/scheduler/renderer/renderer_scheduler.h" |
| 23 #include "public/platform/scheduler/base/task_time_tracker.h" |
| 25 | 24 |
| 26 namespace base { | 25 namespace base { |
| 27 namespace trace_event { | 26 namespace trace_event { |
| 28 class ConvertableToTraceFormat; | 27 class ConvertableToTraceFormat; |
| 29 } | 28 } |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace blink { | 31 namespace blink { |
| 33 namespace scheduler { | 32 namespace scheduler { |
| 34 class AutoAdvancingVirtualTimeDomain; | 33 class AutoAdvancingVirtualTimeDomain; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void SetAllRenderWidgetsHidden(bool hidden) override; | 123 void SetAllRenderWidgetsHidden(bool hidden) override; |
| 125 void SetHasVisibleRenderWidgetWithTouchHandler( | 124 void SetHasVisibleRenderWidgetWithTouchHandler( |
| 126 bool has_visible_render_widget_with_touch_handler) override; | 125 bool has_visible_render_widget_with_touch_handler) override; |
| 127 | 126 |
| 128 // SchedulerHelper::Observer implementation: | 127 // SchedulerHelper::Observer implementation: |
| 129 void OnUnregisterTaskQueue(const scoped_refptr<TaskQueue>& queue) override; | 128 void OnUnregisterTaskQueue(const scoped_refptr<TaskQueue>& queue) override; |
| 130 void OnTriedToExecuteBlockedTask(const TaskQueue& queue, | 129 void OnTriedToExecuteBlockedTask(const TaskQueue& queue, |
| 131 const base::PendingTask& task) override; | 130 const base::PendingTask& task) override; |
| 132 | 131 |
| 133 // TaskTimeTracker implementation: | 132 // TaskTimeTracker implementation: |
| 134 void ReportTaskTime(base::TimeTicks start_time, | 133 void ReportTaskTime(double start_time, double end_time) override; |
| 135 base::TimeTicks end_time) override; | |
| 136 | 134 |
| 137 // QueueingTimeEstimator::Client implementation: | 135 // QueueingTimeEstimator::Client implementation: |
| 138 void OnQueueingTimeForWindowEstimated(base::TimeDelta queueing_time) override; | 136 void OnQueueingTimeForWindowEstimated(base::TimeDelta queueing_time) override; |
| 139 | 137 |
| 140 // Returns a task runner where tasks run at the highest possible priority. | 138 // Returns a task runner where tasks run at the highest possible priority. |
| 141 scoped_refptr<TaskQueue> ControlTaskRunner(); | 139 scoped_refptr<TaskQueue> ControlTaskRunner(); |
| 142 | 140 |
| 143 void RegisterTimeDomain(TimeDomain* time_domain); | 141 void RegisterTimeDomain(TimeDomain* time_domain); |
| 144 void UnregisterTimeDomain(TimeDomain* time_domain); | 142 void UnregisterTimeDomain(TimeDomain* time_domain); |
| 145 | 143 |
| 146 // Tells the scheduler that all TaskQueues should use virtual time. | 144 // Tells the scheduler that all TaskQueues should use virtual time. |
| 147 void EnableVirtualTime(); | 145 void EnableVirtualTime(); |
| 148 | 146 |
| 149 void AddWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler); | 147 void AddWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler); |
| 150 void RemoveWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler); | 148 void RemoveWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler); |
| 151 | 149 |
| 152 LongTaskTracker::LongTaskTiming GetLongTaskTiming(); | 150 void AddTaskTimeTracker(TaskTimeTracker* task_time_tracker); |
| 151 void RemoveTaskTimeTracker(TaskTimeTracker* task_time_tracker); |
| 153 | 152 |
| 154 // Test helpers. | 153 // Test helpers. |
| 155 SchedulerHelper* GetSchedulerHelperForTesting(); | 154 SchedulerHelper* GetSchedulerHelperForTesting(); |
| 156 TaskCostEstimator* GetLoadingTaskCostEstimatorForTesting(); | 155 TaskCostEstimator* GetLoadingTaskCostEstimatorForTesting(); |
| 157 TaskCostEstimator* GetTimerTaskCostEstimatorForTesting(); | 156 TaskCostEstimator* GetTimerTaskCostEstimatorForTesting(); |
| 158 IdleTimeEstimator* GetIdleTimeEstimatorForTesting(); | 157 IdleTimeEstimator* GetIdleTimeEstimatorForTesting(); |
| 159 base::TimeTicks CurrentIdleTaskDeadlineForTesting() const; | 158 base::TimeTicks CurrentIdleTaskDeadlineForTesting() const; |
| 160 void RunIdleTasksForTesting(const base::Closure& callback); | 159 void RunIdleTasksForTesting(const base::Closure& callback); |
| 161 void EndIdlePeriodForTesting(const base::Closure& callback, | 160 void EndIdlePeriodForTesting(const base::Closure& callback, |
| 162 base::TimeTicks time_remaining); | 161 base::TimeTicks time_remaining); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 361 |
| 363 struct MainThreadOnly { | 362 struct MainThreadOnly { |
| 364 MainThreadOnly(RendererSchedulerImpl* renderer_scheduler_impl, | 363 MainThreadOnly(RendererSchedulerImpl* renderer_scheduler_impl, |
| 365 const scoped_refptr<TaskQueue>& compositor_task_runner, | 364 const scoped_refptr<TaskQueue>& compositor_task_runner, |
| 366 base::TickClock* time_source); | 365 base::TickClock* time_source); |
| 367 ~MainThreadOnly(); | 366 ~MainThreadOnly(); |
| 368 | 367 |
| 369 TaskCostEstimator loading_task_cost_estimator; | 368 TaskCostEstimator loading_task_cost_estimator; |
| 370 TaskCostEstimator timer_task_cost_estimator; | 369 TaskCostEstimator timer_task_cost_estimator; |
| 371 QueueingTimeEstimator queueing_time_estimator; | 370 QueueingTimeEstimator queueing_time_estimator; |
| 372 LongTaskTracker long_task_tracker; | |
| 373 IdleTimeEstimator idle_time_estimator; | 371 IdleTimeEstimator idle_time_estimator; |
| 374 UseCase current_use_case; | 372 UseCase current_use_case; |
| 375 Policy current_policy; | 373 Policy current_policy; |
| 376 base::TimeTicks current_policy_expiration_time; | 374 base::TimeTicks current_policy_expiration_time; |
| 377 base::TimeTicks estimated_next_frame_begin; | 375 base::TimeTicks estimated_next_frame_begin; |
| 378 base::TimeDelta compositor_frame_interval; | 376 base::TimeDelta compositor_frame_interval; |
| 379 base::TimeDelta longest_jank_free_task_duration; | 377 base::TimeDelta longest_jank_free_task_duration; |
| 380 int timer_queue_suspend_count; // TIMER_TASK_QUEUE suspended if non-zero. | 378 int timer_queue_suspend_count; // TIMER_TASK_QUEUE suspended if non-zero. |
| 381 int navigation_task_expected_count; | 379 int navigation_task_expected_count; |
| 382 ExpensiveTaskPolicy expensive_task_policy; | 380 ExpensiveTaskPolicy expensive_task_policy; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 PollableThreadSafeFlag policy_may_need_update_; | 465 PollableThreadSafeFlag policy_may_need_update_; |
| 468 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; | 466 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
| 469 | 467 |
| 470 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); | 468 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); |
| 471 }; | 469 }; |
| 472 | 470 |
| 473 } // namespace scheduler | 471 } // namespace scheduler |
| 474 } // namespace blink | 472 } // namespace blink |
| 475 | 473 |
| 476 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU
LER_IMPL_H_ | 474 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU
LER_IMPL_H_ |
| OLD | NEW |