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

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

Issue 2259013003: Move and rename TaskTimeTracker to public interface exposed to WebThread, use in WebPerf Agent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch TaskTimeTracker over to WebThread::TaskTimeObserver Created 4 years, 4 months 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"
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" 13 #include "platform/scheduler/base/task_time_tracker.h"
15 #include "platform/scheduler/child/idle_helper.h" 14 #include "platform/scheduler/child/idle_helper.h"
16 #include "platform/scheduler/child/scheduler_helper.h" 15 #include "platform/scheduler/child/scheduler_helper.h"
17 #include "platform/scheduler/renderer/deadline_task_runner.h" 16 #include "platform/scheduler/renderer/deadline_task_runner.h"
18 #include "platform/scheduler/renderer/idle_time_estimator.h" 17 #include "platform/scheduler/renderer/idle_time_estimator.h"
19 #include "platform/scheduler/renderer/render_widget_signals.h" 18 #include "platform/scheduler/renderer/render_widget_signals.h"
20 #include "public/platform/scheduler/renderer/renderer_scheduler.h" 19 #include "public/platform/scheduler/renderer/renderer_scheduler.h"
21 #include "platform/scheduler/renderer/task_cost_estimator.h" 20 #include "platform/scheduler/renderer/task_cost_estimator.h"
(...skipping 12 matching lines...) Expand all
34 class AutoAdvancingVirtualTimeDomain; 33 class AutoAdvancingVirtualTimeDomain;
35 class RenderWidgetSchedulingState; 34 class RenderWidgetSchedulingState;
36 class WebViewSchedulerImpl; 35 class WebViewSchedulerImpl;
37 class ThrottlingHelper; 36 class ThrottlingHelper;
38 37
39 class BLINK_PLATFORM_EXPORT RendererSchedulerImpl 38 class BLINK_PLATFORM_EXPORT RendererSchedulerImpl
40 : public RendererScheduler, 39 : public RendererScheduler,
41 public IdleHelper::Delegate, 40 public IdleHelper::Delegate,
42 public SchedulerHelper::Observer, 41 public SchedulerHelper::Observer,
43 public RenderWidgetSignals::Observer, 42 public RenderWidgetSignals::Observer,
44 public TaskTimeTracker, 43 public WebThread::TaskTimeObserver,
45 public QueueingTimeEstimator::Client { 44 public QueueingTimeEstimator::Client {
46 public: 45 public:
47 // Keep RendererScheduler::UseCaseToString in sync with this enum. 46 // Keep RendererScheduler::UseCaseToString in sync with this enum.
48 enum class UseCase { 47 enum class UseCase {
49 // No active use case detected. 48 // No active use case detected.
50 NONE, 49 NONE,
51 // A continuous gesture (e.g., scroll, pinch) which is being driven by the 50 // A continuous gesture (e.g., scroll, pinch) which is being driven by the
52 // compositor thread. 51 // compositor thread.
53 COMPOSITOR_GESTURE, 52 COMPOSITOR_GESTURE,
54 // An unspecified touch gesture which is being handled by the main thread. 53 // An unspecified touch gesture which is being handled by the main thread.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // RenderWidgetSignals::Observer implementation: 122 // RenderWidgetSignals::Observer implementation:
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 // WebThread::TaskTimeObserver implementation.
134 void ReportTaskTime(base::TimeTicks start_time, 133 void willProcessTask() override { }
135 base::TimeTicks end_time) override; 134 void didProcessTask() override { }
135 void reportTaskTime(double start_time, double end_time) override;
136 136
137 // QueueingTimeEstimator::Client implementation: 137 // QueueingTimeEstimator::Client implementation:
138 void OnQueueingTimeForWindowEstimated(base::TimeDelta queueing_time) override; 138 void OnQueueingTimeForWindowEstimated(base::TimeDelta queueing_time) override;
139 139
140 // Returns a task runner where tasks run at the highest possible priority. 140 // Returns a task runner where tasks run at the highest possible priority.
141 scoped_refptr<TaskQueue> ControlTaskRunner(); 141 scoped_refptr<TaskQueue> ControlTaskRunner();
142 142
143 void RegisterTimeDomain(TimeDomain* time_domain); 143 void RegisterTimeDomain(TimeDomain* time_domain);
144 void UnregisterTimeDomain(TimeDomain* time_domain); 144 void UnregisterTimeDomain(TimeDomain* time_domain);
145 145
146 // Tells the scheduler that all TaskQueues should use virtual time. 146 // Tells the scheduler that all TaskQueues should use virtual time.
147 void EnableVirtualTime(); 147 void EnableVirtualTime();
148 148
149 void AddWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler); 149 void AddWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler);
150 void RemoveWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler); 150 void RemoveWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler);
151 151
152 LongTaskTracker::LongTaskTiming GetLongTaskTiming(); 152 void AddTaskTimeObserver(WebThread::TaskTimeObserver* task_time_observer);
153 void RemoveTaskTimeObserver(WebThread::TaskTimeObserver* task_time_observer);
153 154
154 // Test helpers. 155 // Test helpers.
155 SchedulerHelper* GetSchedulerHelperForTesting(); 156 SchedulerHelper* GetSchedulerHelperForTesting();
156 TaskCostEstimator* GetLoadingTaskCostEstimatorForTesting(); 157 TaskCostEstimator* GetLoadingTaskCostEstimatorForTesting();
157 TaskCostEstimator* GetTimerTaskCostEstimatorForTesting(); 158 TaskCostEstimator* GetTimerTaskCostEstimatorForTesting();
158 IdleTimeEstimator* GetIdleTimeEstimatorForTesting(); 159 IdleTimeEstimator* GetIdleTimeEstimatorForTesting();
159 base::TimeTicks CurrentIdleTaskDeadlineForTesting() const; 160 base::TimeTicks CurrentIdleTaskDeadlineForTesting() const;
160 void RunIdleTasksForTesting(const base::Closure& callback); 161 void RunIdleTasksForTesting(const base::Closure& callback);
161 void EndIdlePeriodForTesting(const base::Closure& callback, 162 void EndIdlePeriodForTesting(const base::Closure& callback,
162 base::TimeTicks time_remaining); 163 base::TimeTicks time_remaining);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 374
374 struct MainThreadOnly { 375 struct MainThreadOnly {
375 MainThreadOnly(RendererSchedulerImpl* renderer_scheduler_impl, 376 MainThreadOnly(RendererSchedulerImpl* renderer_scheduler_impl,
376 const scoped_refptr<TaskQueue>& compositor_task_runner, 377 const scoped_refptr<TaskQueue>& compositor_task_runner,
377 base::TickClock* time_source); 378 base::TickClock* time_source);
378 ~MainThreadOnly(); 379 ~MainThreadOnly();
379 380
380 TaskCostEstimator loading_task_cost_estimator; 381 TaskCostEstimator loading_task_cost_estimator;
381 TaskCostEstimator timer_task_cost_estimator; 382 TaskCostEstimator timer_task_cost_estimator;
382 QueueingTimeEstimator queueing_time_estimator; 383 QueueingTimeEstimator queueing_time_estimator;
383 LongTaskTracker long_task_tracker;
384 IdleTimeEstimator idle_time_estimator; 384 IdleTimeEstimator idle_time_estimator;
385 UseCase current_use_case; 385 UseCase current_use_case;
386 Policy current_policy; 386 Policy current_policy;
387 base::TimeTicks current_policy_expiration_time; 387 base::TimeTicks current_policy_expiration_time;
388 base::TimeTicks estimated_next_frame_begin; 388 base::TimeTicks estimated_next_frame_begin;
389 base::TimeDelta compositor_frame_interval; 389 base::TimeDelta compositor_frame_interval;
390 base::TimeDelta longest_jank_free_task_duration; 390 base::TimeDelta longest_jank_free_task_duration;
391 int timer_queue_suspend_count; // TIMER_TASK_QUEUE suspended if non-zero. 391 int timer_queue_suspend_count; // TIMER_TASK_QUEUE suspended if non-zero.
392 int navigation_task_expected_count; 392 int navigation_task_expected_count;
393 ExpensiveTaskPolicy expensive_task_policy; 393 ExpensiveTaskPolicy expensive_task_policy;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 PollableThreadSafeFlag policy_may_need_update_; 478 PollableThreadSafeFlag policy_may_need_update_;
479 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; 479 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_;
480 480
481 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); 481 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl);
482 }; 482 };
483 483
484 } // namespace scheduler 484 } // namespace scheduler
485 } // namespace blink 485 } // namespace blink
486 486
487 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU LER_IMPL_H_ 487 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU LER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698