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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc

Issue 2860263002: NOT FOR COMMIT: Move background pausing to the WebView level
Patch Set: Created 3 years, 7 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 "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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 helper_.scheduler_tqm_delegate().get(), 112 helper_.scheduler_tqm_delegate().get(),
113 helper_.scheduler_tqm_delegate()->NowTicks()), 113 helper_.scheduler_tqm_delegate()->NowTicks()),
114 policy_may_need_update_(&any_thread_lock_), 114 policy_may_need_update_(&any_thread_lock_),
115 weak_factory_(this) { 115 weak_factory_(this) {
116 task_queue_throttler_.reset(new TaskQueueThrottler(this)); 116 task_queue_throttler_.reset(new TaskQueueThrottler(this));
117 update_policy_closure_ = base::Bind(&RendererSchedulerImpl::UpdatePolicy, 117 update_policy_closure_ = base::Bind(&RendererSchedulerImpl::UpdatePolicy,
118 weak_factory_.GetWeakPtr()); 118 weak_factory_.GetWeakPtr());
119 end_renderer_hidden_idle_period_closure_.Reset(base::Bind( 119 end_renderer_hidden_idle_period_closure_.Reset(base::Bind(
120 &RendererSchedulerImpl::EndIdlePeriod, weak_factory_.GetWeakPtr())); 120 &RendererSchedulerImpl::EndIdlePeriod, weak_factory_.GetWeakPtr()));
121 121
122 suspend_timers_when_backgrounded_closure_.Reset(
123 base::Bind(&RendererSchedulerImpl::SuspendTimerQueueWhenBackgrounded,
124 weak_factory_.GetWeakPtr()));
125
126 default_loading_task_queue_ = 122 default_loading_task_queue_ =
127 NewLoadingTaskQueue(TaskQueue::QueueType::DEFAULT_LOADING); 123 NewLoadingTaskQueue(TaskQueue::QueueType::DEFAULT_LOADING);
128 default_timer_task_queue_ = 124 default_timer_task_queue_ =
129 NewTimerTaskQueue(TaskQueue::QueueType::DEFAULT_TIMER); 125 NewTimerTaskQueue(TaskQueue::QueueType::DEFAULT_TIMER);
130 126
131 TRACE_EVENT_OBJECT_CREATED_WITH_ID( 127 TRACE_EVENT_OBJECT_CREATED_WITH_ID(
132 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "RendererScheduler", 128 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "RendererScheduler",
133 this); 129 this);
134 130
135 helper_.SetObserver(this); 131 helper_.SetObserver(this);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 now, 191 now,
196 base::Bind(&ReportForegroundRendererTaskLoad), 192 base::Bind(&ReportForegroundRendererTaskLoad),
197 kThreadLoadTrackerReportingInterval, 193 kThreadLoadTrackerReportingInterval,
198 kThreadLoadTrackerWaitingPeriodBeforeReporting), 194 kThreadLoadTrackerWaitingPeriodBeforeReporting),
199 current_use_case(UseCase::NONE), 195 current_use_case(UseCase::NONE),
200 timer_queue_suspend_count(0), 196 timer_queue_suspend_count(0),
201 navigation_task_expected_count(0), 197 navigation_task_expected_count(0),
202 expensive_task_policy(ExpensiveTaskPolicy::RUN), 198 expensive_task_policy(ExpensiveTaskPolicy::RUN),
203 renderer_hidden(false), 199 renderer_hidden(false),
204 renderer_backgrounded(false), 200 renderer_backgrounded(false),
205 renderer_suspended(false),
206 timer_queue_suspension_when_backgrounded_enabled(false),
207 timer_queue_suspended_when_backgrounded(false),
208 was_shutdown(false), 201 was_shutdown(false),
209 loading_tasks_seem_expensive(false), 202 loading_tasks_seem_expensive(false),
210 timer_tasks_seem_expensive(false), 203 timer_tasks_seem_expensive(false),
211 touchstart_expected_soon(false), 204 touchstart_expected_soon(false),
212 have_seen_a_begin_main_frame(false), 205 have_seen_a_begin_main_frame(false),
213 have_reported_blocking_intervention_in_current_policy(false), 206 have_reported_blocking_intervention_in_current_policy(false),
214 have_reported_blocking_intervention_since_navigation(false), 207 have_reported_blocking_intervention_since_navigation(false),
215 has_visible_render_widget_with_touch_handler(false), 208 has_visible_render_widget_with_touch_handler(false),
216 begin_frame_not_expected_soon(false), 209 begin_frame_not_expected_soon(false),
217 in_idle_period_for_testing(false), 210 in_idle_period_for_testing(false),
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 if (helper_.IsShutdown() || GetMainThreadOnly().renderer_backgrounded) 516 if (helper_.IsShutdown() || GetMainThreadOnly().renderer_backgrounded)
524 return; 517 return;
525 518
526 GetMainThreadOnly().renderer_backgrounded = true; 519 GetMainThreadOnly().renderer_backgrounded = true;
527 520
528 UpdatePolicy(); 521 UpdatePolicy();
529 522
530 base::TimeTicks now = tick_clock()->NowTicks(); 523 base::TimeTicks now = tick_clock()->NowTicks();
531 GetMainThreadOnly().foreground_main_thread_load_tracker.Pause(now); 524 GetMainThreadOnly().foreground_main_thread_load_tracker.Pause(now);
532 GetMainThreadOnly().background_main_thread_load_tracker.Resume(now); 525 GetMainThreadOnly().background_main_thread_load_tracker.Resume(now);
533
534 if (!GetMainThreadOnly().timer_queue_suspension_when_backgrounded_enabled)
535 return;
536
537 suspend_timers_when_backgrounded_closure_.Cancel();
538 base::TimeDelta suspend_timers_when_backgrounded_delay =
539 base::TimeDelta::FromMilliseconds(
540 kSuspendTimersWhenBackgroundedDelayMillis);
541 control_task_queue_->PostDelayedTask(
542 FROM_HERE, suspend_timers_when_backgrounded_closure_.GetCallback(),
543 suspend_timers_when_backgrounded_delay);
544 } 526 }
545 527
546 void RendererSchedulerImpl::OnRendererForegrounded() { 528 void RendererSchedulerImpl::OnRendererForegrounded() {
547 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), 529 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
548 "RendererSchedulerImpl::OnRendererForegrounded"); 530 "RendererSchedulerImpl::OnRendererForegrounded");
549 helper_.CheckOnValidThread(); 531 helper_.CheckOnValidThread();
550 if (helper_.IsShutdown() || !GetMainThreadOnly().renderer_backgrounded) 532 if (helper_.IsShutdown() || !GetMainThreadOnly().renderer_backgrounded)
551 return; 533 return;
552 534
553 GetMainThreadOnly().renderer_backgrounded = false; 535 GetMainThreadOnly().renderer_backgrounded = false;
554 GetMainThreadOnly().renderer_suspended = false;
555 536
556 UpdatePolicy(); 537 UpdatePolicy();
557 538
558 base::TimeTicks now = tick_clock()->NowTicks(); 539 base::TimeTicks now = tick_clock()->NowTicks();
559 GetMainThreadOnly().foreground_main_thread_load_tracker.Resume(now); 540 GetMainThreadOnly().foreground_main_thread_load_tracker.Resume(now);
560 GetMainThreadOnly().background_main_thread_load_tracker.Pause(now); 541 GetMainThreadOnly().background_main_thread_load_tracker.Pause(now);
561
562 suspend_timers_when_backgrounded_closure_.Cancel();
563 ResumeTimerQueueWhenForegroundedOrResumed();
564 } 542 }
565 543
566 void RendererSchedulerImpl::OnAudioStateChanged() { 544 void RendererSchedulerImpl::OnAudioStateChanged() {
567 bool is_audio_playing = false; 545 bool is_audio_playing = false;
568 for (WebViewSchedulerImpl* web_view_scheduler : 546 for (WebViewSchedulerImpl* web_view_scheduler :
569 GetMainThreadOnly().web_view_schedulers) { 547 GetMainThreadOnly().web_view_schedulers) {
570 is_audio_playing = is_audio_playing || web_view_scheduler->IsAudioPlaying(); 548 is_audio_playing = is_audio_playing || web_view_scheduler->IsAudioPlaying();
571 } 549 }
572 550
573 if (is_audio_playing == GetMainThreadOnly().is_audio_playing) 551 if (is_audio_playing == GetMainThreadOnly().is_audio_playing)
574 return; 552 return;
575 553
576 GetMainThreadOnly().last_audio_state_change = 554 GetMainThreadOnly().last_audio_state_change =
577 helper_.scheduler_tqm_delegate()->NowTicks(); 555 helper_.scheduler_tqm_delegate()->NowTicks();
578 GetMainThreadOnly().is_audio_playing = is_audio_playing; 556 GetMainThreadOnly().is_audio_playing = is_audio_playing;
579 557
580 UpdatePolicy(); 558 UpdatePolicy();
581 } 559 }
582 560
583 void RendererSchedulerImpl::SuspendRenderer() {
584 helper_.CheckOnValidThread();
585 if (helper_.IsShutdown())
586 return;
587 if (!GetMainThreadOnly().renderer_backgrounded)
588 return;
589 suspend_timers_when_backgrounded_closure_.Cancel();
590
591 UMA_HISTOGRAM_COUNTS("PurgeAndSuspend.PendingTaskCount",
592 helper_.GetNumberOfPendingTasks());
593
594 // TODO(hajimehoshi): We might need to suspend not only timer queue but also
595 // e.g. loading tasks or postMessage.
596 GetMainThreadOnly().renderer_suspended = true;
597 SuspendTimerQueueWhenBackgrounded();
598 }
599
600 void RendererSchedulerImpl::ResumeRenderer() {
601 helper_.CheckOnValidThread();
602 if (helper_.IsShutdown())
603 return;
604 if (!GetMainThreadOnly().renderer_backgrounded)
605 return;
606 suspend_timers_when_backgrounded_closure_.Cancel();
607 GetMainThreadOnly().renderer_suspended = false;
608 ResumeTimerQueueWhenForegroundedOrResumed();
609 }
610
611 void RendererSchedulerImpl::EndIdlePeriod() { 561 void RendererSchedulerImpl::EndIdlePeriod() {
612 if (GetMainThreadOnly().in_idle_period_for_testing) 562 if (GetMainThreadOnly().in_idle_period_for_testing)
613 return; 563 return;
614 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), 564 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
615 "RendererSchedulerImpl::EndIdlePeriod"); 565 "RendererSchedulerImpl::EndIdlePeriod");
616 helper_.CheckOnValidThread(); 566 helper_.CheckOnValidThread();
617 idle_helper_.EndIdlePeriod(); 567 idle_helper_.EndIdlePeriod();
618 } 568 }
619 569
620 void RendererSchedulerImpl::EndIdlePeriodForTesting( 570 void RendererSchedulerImpl::EndIdlePeriodForTesting(
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 TimeDomainType::THROTTLED; 1051 TimeDomainType::THROTTLED;
1102 } 1052 }
1103 if (timer_tasks_seem_expensive) { 1053 if (timer_tasks_seem_expensive) {
1104 new_policy.timer_queue_policy.time_domain_type = 1054 new_policy.timer_queue_policy.time_domain_type =
1105 TimeDomainType::THROTTLED; 1055 TimeDomainType::THROTTLED;
1106 } 1056 }
1107 break; 1057 break;
1108 } 1058 }
1109 GetMainThreadOnly().expensive_task_policy = expensive_task_policy; 1059 GetMainThreadOnly().expensive_task_policy = expensive_task_policy;
1110 1060
1111 if (GetMainThreadOnly().timer_queue_suspend_count != 0 || 1061 if (GetMainThreadOnly().timer_queue_suspend_count != 0) {
1112 GetMainThreadOnly().timer_queue_suspended_when_backgrounded) {
1113 new_policy.timer_queue_policy.is_enabled = false; 1062 new_policy.timer_queue_policy.is_enabled = false;
1114 // TODO(alexclarke): Figure out if we really need to do this. 1063 // TODO(alexclarke): Figure out if we really need to do this.
1115 new_policy.timer_queue_policy.time_domain_type = TimeDomainType::REAL; 1064 new_policy.timer_queue_policy.time_domain_type = TimeDomainType::REAL;
1116 } 1065 }
1117 1066
1118 if (GetMainThreadOnly().renderer_suspended) {
1119 new_policy.loading_queue_policy.is_enabled = false;
1120 DCHECK(!new_policy.timer_queue_policy.is_enabled);
1121 }
1122
1123 if (GetMainThreadOnly().use_virtual_time) { 1067 if (GetMainThreadOnly().use_virtual_time) {
1124 new_policy.compositor_queue_policy.time_domain_type = 1068 new_policy.compositor_queue_policy.time_domain_type =
1125 TimeDomainType::VIRTUAL; 1069 TimeDomainType::VIRTUAL;
1126 new_policy.default_queue_policy.time_domain_type = TimeDomainType::VIRTUAL; 1070 new_policy.default_queue_policy.time_domain_type = TimeDomainType::VIRTUAL;
1127 new_policy.loading_queue_policy.time_domain_type = TimeDomainType::VIRTUAL; 1071 new_policy.loading_queue_policy.time_domain_type = TimeDomainType::VIRTUAL;
1128 new_policy.timer_queue_policy.time_domain_type = TimeDomainType::VIRTUAL; 1072 new_policy.timer_queue_policy.time_domain_type = TimeDomainType::VIRTUAL;
1129 } 1073 }
1130 1074
1131 new_policy.should_disable_throttling = 1075 new_policy.should_disable_throttling =
1132 ShouldDisableThrottlingBecauseOfAudio(now) || 1076 ShouldDisableThrottlingBecauseOfAudio(now) ||
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 } 1308 }
1365 #endif 1309 #endif
1366 } 1310 }
1367 1311
1368 void RendererSchedulerImpl::ResumeTimerQueue() { 1312 void RendererSchedulerImpl::ResumeTimerQueue() {
1369 GetMainThreadOnly().timer_queue_suspend_count--; 1313 GetMainThreadOnly().timer_queue_suspend_count--;
1370 DCHECK_GE(GetMainThreadOnly().timer_queue_suspend_count, 0); 1314 DCHECK_GE(GetMainThreadOnly().timer_queue_suspend_count, 0);
1371 ForceUpdatePolicy(); 1315 ForceUpdatePolicy();
1372 } 1316 }
1373 1317
1374 void RendererSchedulerImpl::SetTimerQueueSuspensionWhenBackgroundedEnabled(
1375 bool enabled) {
1376 // Note that this will only take effect for the next backgrounded signal.
1377 GetMainThreadOnly().timer_queue_suspension_when_backgrounded_enabled =
1378 enabled;
1379 }
1380
1381 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 1318 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
1382 RendererSchedulerImpl::AsValue(base::TimeTicks optional_now) const { 1319 RendererSchedulerImpl::AsValue(base::TimeTicks optional_now) const {
1383 base::AutoLock lock(any_thread_lock_); 1320 base::AutoLock lock(any_thread_lock_);
1384 return AsValueLocked(optional_now); 1321 return AsValueLocked(optional_now);
1385 } 1322 }
1386 1323
1387 void RendererSchedulerImpl::CreateTraceEventObjectSnapshot() const { 1324 void RendererSchedulerImpl::CreateTraceEventObjectSnapshot() const {
1388 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( 1325 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
1389 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "RendererScheduler", 1326 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "RendererScheduler",
1390 this, AsValue(helper_.scheduler_tqm_delegate()->NowTicks())); 1327 this, AsValue(helper_.scheduler_tqm_delegate()->NowTicks()));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 state->SetBoolean("have_seen_input_since_navigation", 1382 state->SetBoolean("have_seen_input_since_navigation",
1446 GetAnyThread().have_seen_input_since_navigation); 1383 GetAnyThread().have_seen_input_since_navigation);
1447 state->SetBoolean("have_reported_blocking_intervention_in_current_policy", 1384 state->SetBoolean("have_reported_blocking_intervention_in_current_policy",
1448 GetMainThreadOnly() 1385 GetMainThreadOnly()
1449 .have_reported_blocking_intervention_in_current_policy); 1386 .have_reported_blocking_intervention_in_current_policy);
1450 state->SetBoolean( 1387 state->SetBoolean(
1451 "have_reported_blocking_intervention_since_navigation", 1388 "have_reported_blocking_intervention_since_navigation",
1452 GetMainThreadOnly().have_reported_blocking_intervention_since_navigation); 1389 GetMainThreadOnly().have_reported_blocking_intervention_since_navigation);
1453 state->SetBoolean("renderer_backgrounded", 1390 state->SetBoolean("renderer_backgrounded",
1454 GetMainThreadOnly().renderer_backgrounded); 1391 GetMainThreadOnly().renderer_backgrounded);
1455 state->SetBoolean(
1456 "timer_queue_suspended_when_backgrounded",
1457 GetMainThreadOnly().timer_queue_suspended_when_backgrounded);
1458 state->SetInteger("timer_queue_suspend_count", 1392 state->SetInteger("timer_queue_suspend_count",
1459 GetMainThreadOnly().timer_queue_suspend_count); 1393 GetMainThreadOnly().timer_queue_suspend_count);
1460 state->SetDouble("now", (optional_now - base::TimeTicks()).InMillisecondsF()); 1394 state->SetDouble("now", (optional_now - base::TimeTicks()).InMillisecondsF());
1461 state->SetDouble( 1395 state->SetDouble(
1462 "fling_compositor_escalation_deadline", 1396 "fling_compositor_escalation_deadline",
1463 (GetAnyThread().fling_compositor_escalation_deadline - base::TimeTicks()) 1397 (GetAnyThread().fling_compositor_escalation_deadline - base::TimeTicks())
1464 .InMillisecondsF()); 1398 .InMillisecondsF());
1465 state->SetInteger("navigation_task_expected_count", 1399 state->SetInteger("navigation_task_expected_count",
1466 GetMainThreadOnly().navigation_task_expected_count); 1400 GetMainThreadOnly().navigation_task_expected_count);
1467 state->SetDouble( 1401 state->SetDouble(
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 } 1530 }
1597 1531
1598 void RendererSchedulerImpl::OnFirstMeaningfulPaint() { 1532 void RendererSchedulerImpl::OnFirstMeaningfulPaint() {
1599 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), 1533 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
1600 "RendererSchedulerImpl::OnFirstMeaningfulPaint"); 1534 "RendererSchedulerImpl::OnFirstMeaningfulPaint");
1601 base::AutoLock lock(any_thread_lock_); 1535 base::AutoLock lock(any_thread_lock_);
1602 GetAnyThread().waiting_for_meaningful_paint = false; 1536 GetAnyThread().waiting_for_meaningful_paint = false;
1603 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); 1537 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED);
1604 } 1538 }
1605 1539
1606 void RendererSchedulerImpl::SuspendTimerQueueWhenBackgrounded() {
1607 DCHECK(GetMainThreadOnly().renderer_backgrounded);
1608 if (GetMainThreadOnly().timer_queue_suspended_when_backgrounded)
1609 return;
1610
1611 GetMainThreadOnly().timer_queue_suspended_when_backgrounded = true;
1612 ForceUpdatePolicy();
1613 Platform::Current()->RequestPurgeMemory();
1614 }
1615
1616 void RendererSchedulerImpl::ResumeTimerQueueWhenForegroundedOrResumed() {
1617 DCHECK(!GetMainThreadOnly().renderer_backgrounded ||
1618 (GetMainThreadOnly().renderer_backgrounded &&
1619 !GetMainThreadOnly().renderer_suspended));
1620 if (!GetMainThreadOnly().timer_queue_suspended_when_backgrounded)
1621 return;
1622
1623 GetMainThreadOnly().timer_queue_suspended_when_backgrounded = false;
1624 ForceUpdatePolicy();
1625 }
1626
1627 void RendererSchedulerImpl::ResetForNavigationLocked() { 1540 void RendererSchedulerImpl::ResetForNavigationLocked() {
1628 helper_.CheckOnValidThread(); 1541 helper_.CheckOnValidThread();
1629 any_thread_lock_.AssertAcquired(); 1542 any_thread_lock_.AssertAcquired();
1630 GetAnyThread().user_model.Reset(helper_.scheduler_tqm_delegate()->NowTicks()); 1543 GetAnyThread().user_model.Reset(helper_.scheduler_tqm_delegate()->NowTicks());
1631 GetAnyThread().have_seen_touchstart = false; 1544 GetAnyThread().have_seen_touchstart = false;
1632 GetAnyThread().waiting_for_meaningful_paint = true; 1545 GetAnyThread().waiting_for_meaningful_paint = true;
1633 GetAnyThread().have_seen_input_since_navigation = false; 1546 GetAnyThread().have_seen_input_since_navigation = false;
1634 GetMainThreadOnly().loading_task_cost_estimator.Clear(); 1547 GetMainThreadOnly().loading_task_cost_estimator.Clear();
1635 GetMainThreadOnly().timer_task_cost_estimator.Clear(); 1548 GetMainThreadOnly().timer_task_cost_estimator.Clear();
1636 GetMainThreadOnly().idle_time_estimator.Clear(); 1549 GetMainThreadOnly().idle_time_estimator.Clear();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 for (auto* web_view_scheduler : GetMainThreadOnly().web_view_schedulers) 1643 for (auto* web_view_scheduler : GetMainThreadOnly().web_view_schedulers)
1731 web_view_scheduler->ReportIntervention(message); 1644 web_view_scheduler->ReportIntervention(message);
1732 } 1645 }
1733 1646
1734 void RendererSchedulerImpl::OnTriedToExecuteBlockedTask( 1647 void RendererSchedulerImpl::OnTriedToExecuteBlockedTask(
1735 const TaskQueue& queue, 1648 const TaskQueue& queue,
1736 const base::PendingTask& task) { 1649 const base::PendingTask& task) {
1737 if (GetMainThreadOnly().current_use_case == UseCase::TOUCHSTART || 1650 if (GetMainThreadOnly().current_use_case == UseCase::TOUCHSTART ||
1738 GetMainThreadOnly().longest_jank_free_task_duration < 1651 GetMainThreadOnly().longest_jank_free_task_duration <
1739 base::TimeDelta::FromMilliseconds(kRailsResponseTimeMillis) || 1652 base::TimeDelta::FromMilliseconds(kRailsResponseTimeMillis) ||
1740 GetMainThreadOnly().timer_queue_suspend_count || 1653 GetMainThreadOnly().timer_queue_suspend_count) {
1741 GetMainThreadOnly().timer_queue_suspended_when_backgrounded) {
1742 return; 1654 return;
1743 } 1655 }
1744 if (!GetMainThreadOnly().timer_tasks_seem_expensive && 1656 if (!GetMainThreadOnly().timer_tasks_seem_expensive &&
1745 !GetMainThreadOnly().loading_tasks_seem_expensive) { 1657 !GetMainThreadOnly().loading_tasks_seem_expensive) {
1746 return; 1658 return;
1747 } 1659 }
1748 if (!GetMainThreadOnly() 1660 if (!GetMainThreadOnly()
1749 .have_reported_blocking_intervention_in_current_policy) { 1661 .have_reported_blocking_intervention_in_current_policy) {
1750 GetMainThreadOnly().have_reported_blocking_intervention_in_current_policy = 1662 GetMainThreadOnly().have_reported_blocking_intervention_in_current_policy =
1751 true; 1663 true;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 case TimeDomainType::VIRTUAL: 1869 case TimeDomainType::VIRTUAL:
1958 return "virtual"; 1870 return "virtual";
1959 default: 1871 default:
1960 NOTREACHED(); 1872 NOTREACHED();
1961 return nullptr; 1873 return nullptr;
1962 } 1874 }
1963 } 1875 }
1964 1876
1965 } // namespace scheduler 1877 } // namespace scheduler
1966 } // namespace blink 1878 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698