| 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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 const std::string& message) { | 1287 const std::string& message) { |
| 1288 helper_.CheckOnValidThread(); | 1288 helper_.CheckOnValidThread(); |
| 1289 for (auto& web_view_scheduler : MainThreadOnly().web_view_schedulers_) | 1289 for (auto& web_view_scheduler : MainThreadOnly().web_view_schedulers_) |
| 1290 web_view_scheduler->AddConsoleWarning(message); | 1290 web_view_scheduler->AddConsoleWarning(message); |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 void RendererSchedulerImpl::OnTriedToExecuteBlockedTask( | 1293 void RendererSchedulerImpl::OnTriedToExecuteBlockedTask( |
| 1294 const TaskQueue& queue, | 1294 const TaskQueue& queue, |
| 1295 const base::PendingTask& task) { | 1295 const base::PendingTask& task) { |
| 1296 if (!MainThreadOnly().expensive_task_blocking_allowed || | 1296 if (!MainThreadOnly().expensive_task_blocking_allowed || |
| 1297 MainThreadOnly().current_use_case == UseCase::TOUCHSTART || |
| 1298 MainThreadOnly().longest_jank_free_task_duration < |
| 1299 base::TimeDelta::FromMilliseconds(kRailsResponseTimeMillis) || |
| 1297 MainThreadOnly().timer_queue_suspend_count || | 1300 MainThreadOnly().timer_queue_suspend_count || |
| 1298 MainThreadOnly().timer_queue_suspended_when_backgrounded) { | 1301 MainThreadOnly().timer_queue_suspended_when_backgrounded) { |
| 1299 return; | 1302 return; |
| 1300 } | 1303 } |
| 1304 if (!MainThreadOnly().timer_tasks_seem_expensive && |
| 1305 !MainThreadOnly().loading_tasks_seem_expensive) { |
| 1306 return; |
| 1307 } |
| 1301 if (!MainThreadOnly().have_reported_blocking_intervention_in_current_policy) { | 1308 if (!MainThreadOnly().have_reported_blocking_intervention_in_current_policy) { |
| 1302 MainThreadOnly().have_reported_blocking_intervention_in_current_policy = | 1309 MainThreadOnly().have_reported_blocking_intervention_in_current_policy = |
| 1303 true; | 1310 true; |
| 1304 TRACE_EVENT_INSTANT0("renderer.scheduler", | 1311 TRACE_EVENT_INSTANT0("renderer.scheduler", |
| 1305 "RendererSchedulerImpl::TaskBlocked", | 1312 "RendererSchedulerImpl::TaskBlocked", |
| 1306 TRACE_EVENT_SCOPE_THREAD); | 1313 TRACE_EVENT_SCOPE_THREAD); |
| 1307 } | 1314 } |
| 1308 | 1315 |
| 1309 if (!MainThreadOnly().have_reported_blocking_intervention_since_navigation) { | 1316 if (!MainThreadOnly().have_reported_blocking_intervention_since_navigation) { |
| 1310 { | 1317 { |
| 1311 base::AutoLock lock(any_thread_lock_); | 1318 base::AutoLock lock(any_thread_lock_); |
| 1312 if (!AnyThread().have_seen_touchstart) | 1319 if (!AnyThread().have_seen_touchstart) |
| 1313 return; | 1320 return; |
| 1314 } | 1321 } |
| 1315 MainThreadOnly().have_reported_blocking_intervention_since_navigation = | 1322 MainThreadOnly().have_reported_blocking_intervention_since_navigation = |
| 1316 true; | 1323 true; |
| 1317 BroadcastConsoleWarning( | 1324 BroadcastConsoleWarning( |
| 1318 "Blink deferred a task in order to make scrolling smoother. " | 1325 "Blink deferred a task in order to make scrolling smoother. " |
| 1319 "Your timer tasks should take less than 50ms to run to avoid this. " | 1326 "Your timer and network tasks should take less than 50ms to run " |
| 1320 "Please see " | 1327 "to avoid this. Please see " |
| 1321 "https://developers.google.com/web/tools/chrome-devtools/profile/evaluat
e-performance/rail" | 1328 "https://developers.google.com/web/tools/chrome-devtools/profile/evaluat
e-performance/rail" |
| 1322 " and https://crbug.com/574343#c40 for more information."); | 1329 " and https://crbug.com/574343#c40 for more information."); |
| 1323 } | 1330 } |
| 1324 } | 1331 } |
| 1325 | 1332 |
| 1326 } // namespace scheduler | 1333 } // namespace scheduler |
| OLD | NEW |