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

Side by Side Diff: components/scheduler/renderer/renderer_scheduler_impl.cc

Issue 1587663003: scheduler: Turn expensive task blocking into a finch trial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: html_viewer fix. Created 4 years, 11 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 #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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 renderer_hidden(false), 120 renderer_hidden(false),
121 renderer_backgrounded(false), 121 renderer_backgrounded(false),
122 timer_queue_suspension_when_backgrounded_enabled(false), 122 timer_queue_suspension_when_backgrounded_enabled(false),
123 timer_queue_suspended_when_backgrounded(false), 123 timer_queue_suspended_when_backgrounded(false),
124 was_shutdown(false), 124 was_shutdown(false),
125 loading_tasks_seem_expensive(false), 125 loading_tasks_seem_expensive(false),
126 timer_tasks_seem_expensive(false), 126 timer_tasks_seem_expensive(false),
127 touchstart_expected_soon(false), 127 touchstart_expected_soon(false),
128 have_seen_a_begin_main_frame(false), 128 have_seen_a_begin_main_frame(false),
129 has_visible_render_widget_with_touch_handler(false), 129 has_visible_render_widget_with_touch_handler(false),
130 begin_frame_not_expected_soon(false) {} 130 begin_frame_not_expected_soon(false),
131 expensive_task_blocking_allowed(true) {}
131 132
132 RendererSchedulerImpl::MainThreadOnly::~MainThreadOnly() {} 133 RendererSchedulerImpl::MainThreadOnly::~MainThreadOnly() {}
133 134
134 RendererSchedulerImpl::AnyThread::AnyThread() 135 RendererSchedulerImpl::AnyThread::AnyThread()
135 : awaiting_touch_start_response(false), 136 : awaiting_touch_start_response(false),
136 in_idle_period(false), 137 in_idle_period(false),
137 begin_main_frame_on_critical_path(false), 138 begin_main_frame_on_critical_path(false),
138 last_gesture_was_compositor_driven(false), 139 last_gesture_was_compositor_driven(false),
139 have_seen_touchstart(false) {} 140 have_seen_touchstart(false) {}
140 141
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 712
712 case UseCase::LOADING: 713 case UseCase::LOADING:
713 new_policy.loading_queue_priority = TaskQueue::HIGH_PRIORITY; 714 new_policy.loading_queue_priority = TaskQueue::HIGH_PRIORITY;
714 new_policy.default_queue_priority = TaskQueue::HIGH_PRIORITY; 715 new_policy.default_queue_priority = TaskQueue::HIGH_PRIORITY;
715 break; 716 break;
716 717
717 default: 718 default:
718 NOTREACHED(); 719 NOTREACHED();
719 } 720 }
720 721
722 if (!MainThreadOnly().expensive_task_blocking_allowed) {
723 block_expensive_loading_tasks = false;
724 block_expensive_timer_tasks = false;
725 }
726
721 // Don't block expensive tasks unless we have actually seen something. 727 // Don't block expensive tasks unless we have actually seen something.
722 if (!MainThreadOnly().have_seen_a_begin_main_frame) { 728 if (!MainThreadOnly().have_seen_a_begin_main_frame) {
723 block_expensive_loading_tasks = false; 729 block_expensive_loading_tasks = false;
724 block_expensive_timer_tasks = false; 730 block_expensive_timer_tasks = false;
725 } 731 }
726 732
727 // Don't block expensive tasks if we are expecting a navigation. 733 // Don't block expensive tasks if we are expecting a navigation.
728 if (MainThreadOnly().navigation_task_expected_count > 0) { 734 if (MainThreadOnly().navigation_task_expected_count > 0) {
729 block_expensive_loading_tasks = false; 735 block_expensive_loading_tasks = false;
730 block_expensive_timer_tasks = false; 736 block_expensive_timer_tasks = false;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 } 1082 }
1077 1083
1078 void RendererSchedulerImpl::RegisterTimeDomain(TimeDomain* time_domain) { 1084 void RendererSchedulerImpl::RegisterTimeDomain(TimeDomain* time_domain) {
1079 helper_.RegisterTimeDomain(time_domain); 1085 helper_.RegisterTimeDomain(time_domain);
1080 } 1086 }
1081 1087
1082 void RendererSchedulerImpl::UnregisterTimeDomain(TimeDomain* time_domain) { 1088 void RendererSchedulerImpl::UnregisterTimeDomain(TimeDomain* time_domain) {
1083 helper_.UnregisterTimeDomain(time_domain); 1089 helper_.UnregisterTimeDomain(time_domain);
1084 } 1090 }
1085 1091
1092 void RendererSchedulerImpl::SetExpensiveTaskBlockingAllowed(bool allowed) {
1093 MainThreadOnly().expensive_task_blocking_allowed = allowed;
1094 }
1095
1086 base::TickClock* RendererSchedulerImpl::tick_clock() const { 1096 base::TickClock* RendererSchedulerImpl::tick_clock() const {
1087 return helper_.scheduler_tqm_delegate().get(); 1097 return helper_.scheduler_tqm_delegate().get();
1088 } 1098 }
1089 1099
1090 } // namespace scheduler 1100 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698