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 "components/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "components/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/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 } | 625 } |
626 MainThreadOnly().touchstart_expected_soon = touchstart_expected_soon; | 626 MainThreadOnly().touchstart_expected_soon = touchstart_expected_soon; |
627 | 627 |
628 base::TimeDelta longest_jank_free_task_duration = | 628 base::TimeDelta longest_jank_free_task_duration = |
629 EstimateLongestJankFreeTaskDuration(); | 629 EstimateLongestJankFreeTaskDuration(); |
630 MainThreadOnly().longest_jank_free_task_duration = | 630 MainThreadOnly().longest_jank_free_task_duration = |
631 longest_jank_free_task_duration; | 631 longest_jank_free_task_duration; |
632 | 632 |
633 bool loading_tasks_seem_expensive = false; | 633 bool loading_tasks_seem_expensive = false; |
634 bool timer_tasks_seem_expensive = false; | 634 bool timer_tasks_seem_expensive = false; |
635 // Only deem tasks to be exensive (which may cause them to be preemptively | 635 loading_tasks_seem_expensive = |
636 // blocked) if we are expecting frames. | 636 MainThreadOnly().loading_task_cost_estimator.expected_task_duration() > |
637 if (!MainThreadOnly().begin_frame_not_expected_soon) { | 637 longest_jank_free_task_duration; |
638 loading_tasks_seem_expensive = | 638 timer_tasks_seem_expensive = |
639 MainThreadOnly().loading_task_cost_estimator.expected_task_duration() > | 639 MainThreadOnly().timer_task_cost_estimator.expected_task_duration() > |
640 longest_jank_free_task_duration; | 640 longest_jank_free_task_duration; |
641 timer_tasks_seem_expensive = | |
642 MainThreadOnly().timer_task_cost_estimator.expected_task_duration() > | |
643 longest_jank_free_task_duration; | |
644 } | |
645 MainThreadOnly().timer_tasks_seem_expensive = timer_tasks_seem_expensive; | 641 MainThreadOnly().timer_tasks_seem_expensive = timer_tasks_seem_expensive; |
646 MainThreadOnly().loading_tasks_seem_expensive = loading_tasks_seem_expensive; | 642 MainThreadOnly().loading_tasks_seem_expensive = loading_tasks_seem_expensive; |
647 | 643 |
648 // The |new_policy_duration| is the minimum of |expected_use_case_duration| | 644 // The |new_policy_duration| is the minimum of |expected_use_case_duration| |
649 // and |touchstart_expected_flag_valid_for_duration| unless one is zero in | 645 // and |touchstart_expected_flag_valid_for_duration| unless one is zero in |
650 // which case we choose the other. | 646 // which case we choose the other. |
651 base::TimeDelta new_policy_duration = expected_use_case_duration; | 647 base::TimeDelta new_policy_duration = expected_use_case_duration; |
652 if (new_policy_duration == base::TimeDelta() || | 648 if (new_policy_duration == base::TimeDelta() || |
653 (touchstart_expected_flag_valid_for_duration > base::TimeDelta() && | 649 (touchstart_expected_flag_valid_for_duration > base::TimeDelta() && |
654 new_policy_duration > touchstart_expected_flag_valid_for_duration)) { | 650 new_policy_duration > touchstart_expected_flag_valid_for_duration)) { |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 } | 1191 } |
1196 MainThreadOnly().have_reported_blocking_intervention_since_navigation = | 1192 MainThreadOnly().have_reported_blocking_intervention_since_navigation = |
1197 true; | 1193 true; |
1198 BroadcastConsoleWarning( | 1194 BroadcastConsoleWarning( |
1199 "Deferred long-running timer task(s) to improve scrolling smoothness. " | 1195 "Deferred long-running timer task(s) to improve scrolling smoothness. " |
1200 "See crbug.com/574343."); | 1196 "See crbug.com/574343."); |
1201 } | 1197 } |
1202 } | 1198 } |
1203 | 1199 |
1204 } // namespace scheduler | 1200 } // namespace scheduler |
OLD | NEW |