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 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 void RendererSchedulerImpl::EndIdlePeriod() { | 491 void RendererSchedulerImpl::EndIdlePeriod() { |
492 if (MainThreadOnly().in_idle_period_for_testing) | 492 if (MainThreadOnly().in_idle_period_for_testing) |
493 return; | 493 return; |
494 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 494 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
495 "RendererSchedulerImpl::EndIdlePeriod"); | 495 "RendererSchedulerImpl::EndIdlePeriod"); |
496 helper_.CheckOnValidThread(); | 496 helper_.CheckOnValidThread(); |
497 idle_helper_.EndIdlePeriod(); | 497 idle_helper_.EndIdlePeriod(); |
498 } | 498 } |
499 | 499 |
500 void RendererSchedulerImpl::EndIdlePeriodForTesting( | 500 void RendererSchedulerImpl::EndIdlePeriodForTesting( |
501 const base::Closure& callback, | 501 base::OnceClosure callback, |
502 base::TimeTicks time_remaining) { | 502 base::TimeTicks time_remaining) { |
503 MainThreadOnly().in_idle_period_for_testing = false; | 503 MainThreadOnly().in_idle_period_for_testing = false; |
504 EndIdlePeriod(); | 504 EndIdlePeriod(); |
505 callback.Run(); | 505 std::move(callback).Run(); |
506 } | 506 } |
507 | 507 |
508 bool RendererSchedulerImpl::PolicyNeedsUpdateForTesting() { | 508 bool RendererSchedulerImpl::PolicyNeedsUpdateForTesting() { |
509 return policy_may_need_update_.IsSet(); | 509 return policy_may_need_update_.IsSet(); |
510 } | 510 } |
511 | 511 |
512 // static | 512 // static |
513 bool RendererSchedulerImpl::ShouldPrioritizeInputEvent( | 513 bool RendererSchedulerImpl::ShouldPrioritizeInputEvent( |
514 const blink::WebInputEvent& web_input_event) { | 514 const blink::WebInputEvent& web_input_event) { |
515 // We regard MouseMove events with the left mouse button down as a signal | 515 // We regard MouseMove events with the left mouse button down as a signal |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 return false; | 716 return false; |
717 } | 717 } |
718 } | 718 } |
719 | 719 |
720 base::TimeTicks RendererSchedulerImpl::CurrentIdleTaskDeadlineForTesting() | 720 base::TimeTicks RendererSchedulerImpl::CurrentIdleTaskDeadlineForTesting() |
721 const { | 721 const { |
722 return idle_helper_.CurrentIdleTaskDeadline(); | 722 return idle_helper_.CurrentIdleTaskDeadline(); |
723 } | 723 } |
724 | 724 |
725 void RendererSchedulerImpl::RunIdleTasksForTesting( | 725 void RendererSchedulerImpl::RunIdleTasksForTesting( |
726 const base::Closure& callback) { | 726 base::OnceClosure callback) { |
727 MainThreadOnly().in_idle_period_for_testing = true; | 727 MainThreadOnly().in_idle_period_for_testing = true; |
728 IdleTaskRunner()->PostIdleTask( | 728 IdleTaskRunner()->PostIdleTask( |
729 FROM_HERE, base::Bind(&RendererSchedulerImpl::EndIdlePeriodForTesting, | 729 FROM_HERE, base::BindOnce(&RendererSchedulerImpl::EndIdlePeriodForTesting, |
730 weak_factory_.GetWeakPtr(), callback)); | 730 weak_factory_.GetWeakPtr(), std::move(callback))
); |
731 idle_helper_.EnableLongIdlePeriod(); | 731 idle_helper_.EnableLongIdlePeriod(); |
732 } | 732 } |
733 | 733 |
734 void RendererSchedulerImpl::MaybeUpdatePolicy() { | 734 void RendererSchedulerImpl::MaybeUpdatePolicy() { |
735 helper_.CheckOnValidThread(); | 735 helper_.CheckOnValidThread(); |
736 if (policy_may_need_update_.IsSet()) { | 736 if (policy_may_need_update_.IsSet()) { |
737 UpdatePolicy(); | 737 UpdatePolicy(); |
738 } | 738 } |
739 } | 739 } |
740 | 740 |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 case v8::PERFORMANCE_LOAD: | 1556 case v8::PERFORMANCE_LOAD: |
1557 return "load"; | 1557 return "load"; |
1558 default: | 1558 default: |
1559 NOTREACHED(); | 1559 NOTREACHED(); |
1560 return nullptr; | 1560 return nullptr; |
1561 } | 1561 } |
1562 } | 1562 } |
1563 | 1563 |
1564 } // namespace scheduler | 1564 } // namespace scheduler |
1565 } // namespace blink | 1565 } // namespace blink |
OLD | NEW |