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/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/metrics/single_sample_metrics.h" |
12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
13 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
14 #include "base/trace_event/trace_log.h" | 15 #include "base/trace_event/trace_log.h" |
15 #include "device/base/synchronization/shared_memory_seqlock_buffer.h" | 16 #include "device/base/synchronization/shared_memory_seqlock_buffer.h" |
16 #include "platform/scheduler/base/pollable_thread_safe_flag.h" | 17 #include "platform/scheduler/base/pollable_thread_safe_flag.h" |
17 #include "platform/scheduler/base/queueing_time_estimator.h" | 18 #include "platform/scheduler/base/queueing_time_estimator.h" |
18 #include "platform/scheduler/base/task_time_observer.h" | 19 #include "platform/scheduler/base/task_time_observer.h" |
19 #include "platform/scheduler/base/thread_load_tracker.h" | 20 #include "platform/scheduler/base/thread_load_tracker.h" |
20 #include "platform/scheduler/child/idle_canceled_delayed_task_sweeper.h" | 21 #include "platform/scheduler/child/idle_canceled_delayed_task_sweeper.h" |
21 #include "platform/scheduler/child/idle_helper.h" | 22 #include "platform/scheduler/child/idle_helper.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 void DidHandleInputEventOnMainThread(const WebInputEvent& web_input_event, | 102 void DidHandleInputEventOnMainThread(const WebInputEvent& web_input_event, |
102 WebInputEventResult result) override; | 103 WebInputEventResult result) override; |
103 void DidAnimateForInputOnCompositorThread() override; | 104 void DidAnimateForInputOnCompositorThread() override; |
104 void OnRendererBackgrounded() override; | 105 void OnRendererBackgrounded() override; |
105 void OnRendererForegrounded() override; | 106 void OnRendererForegrounded() override; |
106 void SuspendRenderer() override; | 107 void SuspendRenderer() override; |
107 void ResumeRenderer() override; | 108 void ResumeRenderer() override; |
108 void AddPendingNavigation(NavigatingFrameType type) override; | 109 void AddPendingNavigation(NavigatingFrameType type) override; |
109 void RemovePendingNavigation(NavigatingFrameType type) override; | 110 void RemovePendingNavigation(NavigatingFrameType type) override; |
110 void OnNavigationStarted() override; | 111 void OnNavigationStarted() override; |
| 112 void OnCommitProvisionalLoad() override; |
111 bool IsHighPriorityWorkAnticipated() override; | 113 bool IsHighPriorityWorkAnticipated() override; |
112 bool ShouldYieldForHighPriorityWork() override; | 114 bool ShouldYieldForHighPriorityWork() override; |
113 bool CanExceedIdleDeadlineIfRequired() const override; | 115 bool CanExceedIdleDeadlineIfRequired() const override; |
114 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override; | 116 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override; |
115 void RemoveTaskObserver( | 117 void RemoveTaskObserver( |
116 base::MessageLoop::TaskObserver* task_observer) override; | 118 base::MessageLoop::TaskObserver* task_observer) override; |
117 void Shutdown() override; | 119 void Shutdown() override; |
118 void SuspendTimerQueue() override; | 120 void SuspendTimerQueue() override; |
119 void ResumeTimerQueue() override; | 121 void ResumeTimerQueue() override; |
120 void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) override; | 122 void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) override; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 369 |
368 // Helper for computing the use case. |expected_usecase_duration| will be | 370 // Helper for computing the use case. |expected_usecase_duration| will be |
369 // filled with the amount of time after which the use case should be updated | 371 // filled with the amount of time after which the use case should be updated |
370 // again. If the duration is zero, a new use case update should not be | 372 // again. If the duration is zero, a new use case update should not be |
371 // scheduled. Must be called with |any_thread_lock_| held. Can be called from | 373 // scheduled. Must be called with |any_thread_lock_| held. Can be called from |
372 // any thread. | 374 // any thread. |
373 UseCase ComputeCurrentUseCase( | 375 UseCase ComputeCurrentUseCase( |
374 base::TimeTicks now, | 376 base::TimeTicks now, |
375 base::TimeDelta* expected_use_case_duration) const; | 377 base::TimeDelta* expected_use_case_duration) const; |
376 | 378 |
| 379 std::unique_ptr<base::SingleSampleMetric> GetMaxQueueingTimeMetric(); |
| 380 |
377 // An input event of some sort happened, the policy may need updating. | 381 // An input event of some sort happened, the policy may need updating. |
378 void UpdateForInputEventOnCompositorThread(WebInputEvent::Type type, | 382 void UpdateForInputEventOnCompositorThread(WebInputEvent::Type type, |
379 InputEventState input_event_state); | 383 InputEventState input_event_state); |
380 | 384 |
381 // Helpers for safely suspending/resuming the timer queue after a | 385 // Helpers for safely suspending/resuming the timer queue after a |
382 // background/foreground signal. | 386 // background/foreground signal. |
383 void SuspendTimerQueueWhenBackgrounded(); | 387 void SuspendTimerQueueWhenBackgrounded(); |
384 void ResumeTimerQueueWhenForegroundedOrResumed(); | 388 void ResumeTimerQueueWhenForegroundedOrResumed(); |
385 | 389 |
386 // The task cost estimators and the UserModel need to be reset upon page | 390 // The task cost estimators and the UserModel need to be reset upon page |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 bool timer_tasks_seem_expensive; | 490 bool timer_tasks_seem_expensive; |
487 bool touchstart_expected_soon; | 491 bool touchstart_expected_soon; |
488 bool have_seen_a_begin_main_frame; | 492 bool have_seen_a_begin_main_frame; |
489 bool have_reported_blocking_intervention_in_current_policy; | 493 bool have_reported_blocking_intervention_in_current_policy; |
490 bool have_reported_blocking_intervention_since_navigation; | 494 bool have_reported_blocking_intervention_since_navigation; |
491 bool has_visible_render_widget_with_touch_handler; | 495 bool has_visible_render_widget_with_touch_handler; |
492 bool begin_frame_not_expected_soon; | 496 bool begin_frame_not_expected_soon; |
493 bool in_idle_period_for_testing; | 497 bool in_idle_period_for_testing; |
494 bool use_virtual_time; | 498 bool use_virtual_time; |
495 bool is_audio_playing; | 499 bool is_audio_playing; |
| 500 bool has_navigated; |
| 501 std::unique_ptr<base::SingleSampleMetric> max_queueing_time_metric; |
| 502 base::TimeDelta max_queueing_time; |
496 std::set<WebViewSchedulerImpl*> web_view_schedulers; // Not owned. | 503 std::set<WebViewSchedulerImpl*> web_view_schedulers; // Not owned. |
497 RAILModeObserver* rail_mode_observer; // Not owned. | 504 RAILModeObserver* rail_mode_observer; // Not owned. |
498 WakeUpBudgetPool* wake_up_budget_pool; // Not owned. | 505 WakeUpBudgetPool* wake_up_budget_pool; // Not owned. |
499 std::array<base::TimeDelta, | 506 std::array<base::TimeDelta, |
500 static_cast<size_t>(TaskQueue::QueueType::COUNT)> | 507 static_cast<size_t>(TaskQueue::QueueType::COUNT)> |
501 unreported_task_duration; | 508 unreported_task_duration; |
502 base::HistogramBase* task_duration_per_queue_type_histogram; | 509 base::HistogramBase* task_duration_per_queue_type_histogram; |
503 }; | 510 }; |
504 | 511 |
505 struct AnyThread { | 512 struct AnyThread { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 579 |
573 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; | 580 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
574 | 581 |
575 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); | 582 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); |
576 }; | 583 }; |
577 | 584 |
578 } // namespace scheduler | 585 } // namespace scheduler |
579 } // namespace blink | 586 } // namespace blink |
580 | 587 |
581 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU
LER_IMPL_H_ | 588 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU
LER_IMPL_H_ |
OLD | NEW |