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

Unified Diff: components/scheduler/renderer/task_cost_estimator.cc

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/scheduler/renderer/task_cost_estimator.cc
diff --git a/components/scheduler/renderer/task_cost_estimator.cc b/components/scheduler/renderer/task_cost_estimator.cc
deleted file mode 100644
index ce8dee9087546b7054025c9a5129cc11eb47bbca..0000000000000000000000000000000000000000
--- a/components/scheduler/renderer/task_cost_estimator.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/scheduler/renderer/task_cost_estimator.h"
-
-#include "base/time/default_tick_clock.h"
-
-namespace scheduler {
-
-TaskCostEstimator::TaskCostEstimator(base::TickClock* time_source,
- int sample_count,
- double estimation_percentile)
- : rolling_time_delta_history_(sample_count),
- time_source_(time_source),
- outstanding_task_count_(0),
- estimation_percentile_(estimation_percentile) {}
-
-TaskCostEstimator::~TaskCostEstimator() {}
-
-void TaskCostEstimator::WillProcessTask(const base::PendingTask& pending_task) {
- // Avoid measuring the duration in nested run loops.
- if (++outstanding_task_count_ == 1)
- task_start_time_ = time_source_->NowTicks();
-}
-
-void TaskCostEstimator::DidProcessTask(const base::PendingTask& pending_task) {
- if (--outstanding_task_count_ == 0) {
- base::TimeDelta duration = time_source_->NowTicks() - task_start_time_;
- rolling_time_delta_history_.InsertSample(duration);
- }
-}
-
-base::TimeDelta TaskCostEstimator::expected_task_duration() const {
- return rolling_time_delta_history_.Percentile(estimation_percentile_);
-}
-
-void TaskCostEstimator::Clear() {
- rolling_time_delta_history_.Clear();
- expected_task_duration_ = base::TimeDelta();
-}
-
-} // namespace scheduler
« no previous file with comments | « components/scheduler/renderer/task_cost_estimator.h ('k') | components/scheduler/renderer/task_cost_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698