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

Unified Diff: third_party/WebKit/Source/platform/scheduler/renderer/budget_pool.h

Issue 2761503002: [scheduler] CPUTimeBudgetPool: Require a minimal level of budget to run (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scheduler/renderer/budget_pool.h
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/budget_pool.h b/third_party/WebKit/Source/platform/scheduler/renderer/budget_pool.h
index 1ece45aadd661b4aaa99392912c01368afbcc3e6..2f40f86b03ac5c7922727a1c21c6da28693736cf 100644
--- a/third_party/WebKit/Source/platform/scheduler/renderer/budget_pool.h
+++ b/third_party/WebKit/Source/platform/scheduler/renderer/budget_pool.h
@@ -84,12 +84,35 @@ class BLINK_PLATFORM_EXPORT CPUTimeBudgetPool : public BudgetPool {
public:
CPUTimeBudgetPool(const char* name,
BudgetPoolController* budget_pool_controller,
- base::TimeTicks now,
- base::Optional<base::TimeDelta> max_budget_level,
- base::Optional<base::TimeDelta> max_throttling_duration);
+ base::TimeTicks now);
~CPUTimeBudgetPool();
+ // Set max budget level, base::nullopt represent absence of max level.
+ // Max budget level prevents accumulating arbitrary large budgets when
+ // page is inactive for a very long time.
+ void SetMaxBudgetLevel(base::TimeTicks now,
+ base::Optional<base::TimeDelta> max_budget_level);
+
+ // Set max throttling duration, base::nullopt represents absense of it.
+ // Max throttling duration prevents page from being throttled for
+ // a very long period after a single long task.
+ void SetMaxThrottlingDelay(
+ base::TimeTicks now,
+ base::Optional<base::TimeDelta> max_throttling_delay);
+
+ // Set minimal budget level required to run a task. If budget pool was
+ // exhausted, it needs to accumulate at least |min_budget_to_run| time units
+ // to run tasks again.
+ // It still can run tasks when budget is positive but less than this level.
alex clarke (OOO till 29th) 2017/03/20 09:03:03 This sentence seems to state the opposite of the p
altimin 2017/03/20 15:21:08 Done.
+ // This is needed for integration with WakeupBudgetPool to prevent a situation
+ // when wakeup happened but time budget pool allows only one task to run at
+ // the moment.
+ // It is recommended to use the same value for this and WakeupBudgetPool's
+ // wakeup window length.
+ void SetMinBudgetLevelToRun(base::TimeTicks now,
+ base::TimeDelta min_budget_level_to_run);
+
// Throttle task queues from this time budget pool if tasks are running
// for more than |cpu_percentage| per cent of wall time.
// This function does not affect internal time budget level.
@@ -142,12 +165,15 @@ class BLINK_PLATFORM_EXPORT CPUTimeBudgetPool : public BudgetPool {
// Tasks will be allowed to run for this time before being throttled
// after a very long period of inactivity.
base::Optional<base::TimeDelta> max_budget_level_;
- // Max throttling duration places a lower limit on time budget level,
+ // Max throttling delay places a lower limit on time budget level,
// ensuring that one long task does not cause extremely long throttling.
// Note that this is not the guarantee that every task will run
alex clarke (OOO till 29th) 2017/03/20 09:03:03 ... is not _a_ guarantee that ...
altimin 2017/03/20 15:21:08 Done.
// after desired run time + max throttling duration, but a guarantee
- // that at least one task will be run every max_throttling_duration.
- base::Optional<base::TimeDelta> max_throttling_duration_;
+ // that at least one task will be run every max_throttling_delay.
+ base::Optional<base::TimeDelta> max_throttling_delay_;
+ // Minimal budget required to be accumulated after queue is blocked
alex clarke (OOO till 29th) 2017/03/20 09:03:03 Could you please reword? I found this sentence con
altimin 2017/03/20 15:21:08 Done.
+ // to prevent queue from being immediately blocked after one small task.
+ base::TimeDelta min_budget_level_to_run_;
base::TimeDelta current_budget_level_;
base::TimeTicks last_checkpoint_;

Powered by Google App Engine
This is Rietveld 408576698