| 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 COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ | 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ |
| 6 #define COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ | 6 #define COMPONENTS_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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 void AddWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler); | 100 void AddWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler); |
| 101 void RemoveWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler); | 101 void RemoveWebViewScheduler(WebViewSchedulerImpl* web_view_scheduler); |
| 102 | 102 |
| 103 // Test helpers. | 103 // Test helpers. |
| 104 SchedulerHelper* GetSchedulerHelperForTesting(); | 104 SchedulerHelper* GetSchedulerHelperForTesting(); |
| 105 TaskCostEstimator* GetLoadingTaskCostEstimatorForTesting(); | 105 TaskCostEstimator* GetLoadingTaskCostEstimatorForTesting(); |
| 106 TaskCostEstimator* GetTimerTaskCostEstimatorForTesting(); | 106 TaskCostEstimator* GetTimerTaskCostEstimatorForTesting(); |
| 107 IdleTimeEstimator* GetIdleTimeEstimatorForTesting(); | 107 IdleTimeEstimator* GetIdleTimeEstimatorForTesting(); |
| 108 base::TimeTicks CurrentIdleTaskDeadlineForTesting() const; | 108 base::TimeTicks CurrentIdleTaskDeadlineForTesting() const; |
| 109 void RunIdleTasksForTesting(const base::Closure& callback); |
| 109 | 110 |
| 110 base::TickClock* tick_clock() const; | 111 base::TickClock* tick_clock() const; |
| 111 | 112 |
| 112 RealTimeDomain* real_time_domain() const { | 113 RealTimeDomain* real_time_domain() const { |
| 113 return helper_.real_time_domain(); | 114 return helper_.real_time_domain(); |
| 114 } | 115 } |
| 115 | 116 |
| 116 ThrottlingHelper* throttling_helper() { return throttling_helper_.get(); } | 117 ThrottlingHelper* throttling_helper() { return throttling_helper_.get(); } |
| 117 | 118 |
| 118 private: | 119 private: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 178 |
| 178 // IdleHelper::Delegate implementation: | 179 // IdleHelper::Delegate implementation: |
| 179 bool CanEnterLongIdlePeriod( | 180 bool CanEnterLongIdlePeriod( |
| 180 base::TimeTicks now, | 181 base::TimeTicks now, |
| 181 base::TimeDelta* next_long_idle_period_delay_out) override; | 182 base::TimeDelta* next_long_idle_period_delay_out) override; |
| 182 void IsNotQuiescent() override {} | 183 void IsNotQuiescent() override {} |
| 183 void OnIdlePeriodStarted() override; | 184 void OnIdlePeriodStarted() override; |
| 184 void OnIdlePeriodEnded() override; | 185 void OnIdlePeriodEnded() override; |
| 185 | 186 |
| 186 void EndIdlePeriod(); | 187 void EndIdlePeriod(); |
| 188 void EndIdlePeriodForTesting( |
| 189 const base::Closure& callback, |
| 190 base::TimeTicks time_remaining); |
| 187 | 191 |
| 188 // Returns the serialized scheduler state for tracing. | 192 // Returns the serialized scheduler state for tracing. |
| 189 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValue( | 193 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValue( |
| 190 base::TimeTicks optional_now) const; | 194 base::TimeTicks optional_now) const; |
| 191 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValueLocked( | 195 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValueLocked( |
| 192 base::TimeTicks optional_now) const; | 196 base::TimeTicks optional_now) const; |
| 193 | 197 |
| 194 static bool ShouldPrioritizeInputEvent( | 198 static bool ShouldPrioritizeInputEvent( |
| 195 const blink::WebInputEvent& web_input_event); | 199 const blink::WebInputEvent& web_input_event); |
| 196 | 200 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 bool was_shutdown; | 340 bool was_shutdown; |
| 337 bool loading_tasks_seem_expensive; | 341 bool loading_tasks_seem_expensive; |
| 338 bool timer_tasks_seem_expensive; | 342 bool timer_tasks_seem_expensive; |
| 339 bool touchstart_expected_soon; | 343 bool touchstart_expected_soon; |
| 340 bool have_seen_a_begin_main_frame; | 344 bool have_seen_a_begin_main_frame; |
| 341 bool have_reported_blocking_intervention_in_current_policy; | 345 bool have_reported_blocking_intervention_in_current_policy; |
| 342 bool have_reported_blocking_intervention_since_navigation; | 346 bool have_reported_blocking_intervention_since_navigation; |
| 343 bool has_visible_render_widget_with_touch_handler; | 347 bool has_visible_render_widget_with_touch_handler; |
| 344 bool begin_frame_not_expected_soon; | 348 bool begin_frame_not_expected_soon; |
| 345 bool expensive_task_blocking_allowed; | 349 bool expensive_task_blocking_allowed; |
| 350 bool in_idle_period_for_testing; |
| 346 std::set<WebViewSchedulerImpl*> web_view_schedulers_; // Not owned. | 351 std::set<WebViewSchedulerImpl*> web_view_schedulers_; // Not owned. |
| 347 }; | 352 }; |
| 348 | 353 |
| 349 struct AnyThread { | 354 struct AnyThread { |
| 350 AnyThread(); | 355 AnyThread(); |
| 351 ~AnyThread(); | 356 ~AnyThread(); |
| 352 | 357 |
| 353 base::TimeTicks last_idle_period_end_time; | 358 base::TimeTicks last_idle_period_end_time; |
| 354 base::TimeTicks rails_loading_priority_deadline; | 359 base::TimeTicks rails_loading_priority_deadline; |
| 355 base::TimeTicks fling_compositor_escalation_deadline; | 360 base::TimeTicks fling_compositor_escalation_deadline; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 416 |
| 412 PollableThreadSafeFlag policy_may_need_update_; | 417 PollableThreadSafeFlag policy_may_need_update_; |
| 413 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; | 418 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
| 414 | 419 |
| 415 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); | 420 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); |
| 416 }; | 421 }; |
| 417 | 422 |
| 418 } // namespace scheduler | 423 } // namespace scheduler |
| 419 | 424 |
| 420 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ | 425 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ |
| OLD | NEW |