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

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: Remove #include <*stream> 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/renderer/budget_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..187daccff5cca142c44519d22b2edfcc9811e6b4 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,38 @@ 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 unblock and run tasks again. When unblocked, it still can run tasks
+ // when budget is positive but less than this level until being blocked
+ // until being blocked when budget reaches zero.
+ // 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.
+ // NOTE: This does not have an immediate effect and does not call
+ // BudgetPoolController::UnblockQueue.
+ 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 +168,14 @@ 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
+ // Note that this is not a guarantee that every task will run
// 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_;
+ // See CPUTimeBudgetPool::SetMinBudgetLevelToRun.
+ base::TimeDelta min_budget_level_to_run_;
base::TimeDelta current_budget_level_;
base::TimeTicks last_checkpoint_;
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/renderer/budget_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698