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

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

Issue 1832673002: Add testRunner.runIdleTasks() to force idle tasks to run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 9 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 11 matching lines...) Expand all
22 // The run time of loading tasks is strongly bimodal. The vast majority are 22 // The run time of loading tasks is strongly bimodal. The vast majority are
23 // very cheap, but there are usually a handful of very expensive tasks (e.g ~1 23 // very cheap, but there are usually a handful of very expensive tasks (e.g ~1
24 // second on a mobile device) so we take a very pesimistic view when estimating 24 // second on a mobile device) so we take a very pesimistic view when estimating
25 // the cost of loading tasks. 25 // the cost of loading tasks.
26 const int kLoadingTaskEstimationSampleCount = 1000; 26 const int kLoadingTaskEstimationSampleCount = 1000;
27 const double kLoadingTaskEstimationPercentile = 99; 27 const double kLoadingTaskEstimationPercentile = 99;
28 const int kTimerTaskEstimationSampleCount = 1000; 28 const int kTimerTaskEstimationSampleCount = 1000;
29 const double kTimerTaskEstimationPercentile = 99; 29 const double kTimerTaskEstimationPercentile = 99;
30 const int kShortIdlePeriodDurationSampleCount = 10; 30 const int kShortIdlePeriodDurationSampleCount = 10;
31 const double kShortIdlePeriodDurationPercentile = 50; 31 const double kShortIdlePeriodDurationPercentile = 50;
32
32 } 33 }
33 34
34 RendererSchedulerImpl::RendererSchedulerImpl( 35 RendererSchedulerImpl::RendererSchedulerImpl(
35 scoped_refptr<SchedulerTqmDelegate> main_task_runner) 36 scoped_refptr<SchedulerTqmDelegate> main_task_runner)
36 : helper_(main_task_runner, 37 : helper_(main_task_runner,
37 "renderer.scheduler", 38 "renderer.scheduler",
38 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), 39 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
39 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler.debug")), 40 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler.debug")),
40 idle_helper_(&helper_, 41 idle_helper_(&helper_,
41 this, 42 this,
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 NOTREACHED(); 568 NOTREACHED();
568 return false; 569 return false;
569 } 570 }
570 } 571 }
571 572
572 base::TimeTicks RendererSchedulerImpl::CurrentIdleTaskDeadlineForTesting() 573 base::TimeTicks RendererSchedulerImpl::CurrentIdleTaskDeadlineForTesting()
573 const { 574 const {
574 return idle_helper_.CurrentIdleTaskDeadline(); 575 return idle_helper_.CurrentIdleTaskDeadline();
575 } 576 }
576 577
578 void RendererSchedulerImpl::RunIdleTasksForTesting(
579 const base::Closure& callback) {
580 idle_helper_.RunIdleTasksForTesting(callback);
581 }
582
577 void RendererSchedulerImpl::MaybeUpdatePolicy() { 583 void RendererSchedulerImpl::MaybeUpdatePolicy() {
578 helper_.CheckOnValidThread(); 584 helper_.CheckOnValidThread();
579 if (policy_may_need_update_.IsSet()) { 585 if (policy_may_need_update_.IsSet()) {
580 UpdatePolicy(); 586 UpdatePolicy();
581 } 587 }
582 } 588 }
583 589
584 void RendererSchedulerImpl::EnsureUrgentPolicyUpdatePostedOnMainThread( 590 void RendererSchedulerImpl::EnsureUrgentPolicyUpdatePostedOnMainThread(
585 const tracked_objects::Location& from_here) { 591 const tracked_objects::Location& from_here) {
586 // TODO(scheduler-dev): Check that this method isn't called from the main 592 // TODO(scheduler-dev): Check that this method isn't called from the main
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 } 1213 }
1208 MainThreadOnly().have_reported_blocking_intervention_since_navigation = 1214 MainThreadOnly().have_reported_blocking_intervention_since_navigation =
1209 true; 1215 true;
1210 BroadcastConsoleWarning( 1216 BroadcastConsoleWarning(
1211 "Deferred long-running timer task(s) to improve scrolling smoothness. " 1217 "Deferred long-running timer task(s) to improve scrolling smoothness. "
1212 "See crbug.com/574343."); 1218 "See crbug.com/574343.");
1213 } 1219 }
1214 } 1220 }
1215 1221
1216 } // namespace scheduler 1222 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698