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

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

Issue 2742383005: [scheduler] Untangle BudgetPool from TaskQueueThrottler. (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 e602b93a5ed587bcba7bc85ceee0c20513aac65b..75f6489b961000ef7e587304689acffa2fd6b57d 100644
--- a/third_party/WebKit/Source/platform/scheduler/renderer/budget_pool.h
+++ b/third_party/WebKit/Source/platform/scheduler/renderer/budget_pool.h
@@ -61,6 +61,9 @@ class BLINK_PLATFORM_EXPORT BudgetPool {
virtual void RecordTaskRunTime(base::TimeTicks start_time,
base::TimeTicks end_time) = 0;
+ // Call TaskQueueThrottler::BlockThrottledQueue for all relevant queues.
Sami 2017/03/14 18:43:00 This is an abstract interface with no obvious ties
altimin 2017/03/14 20:04:28 Done.
+ virtual void BlockThrottledQueues(base::TimeTicks now) = 0;
+
// All queues should be removed before calling Close().
virtual void Close() = 0;
@@ -79,6 +82,12 @@ class BLINK_PLATFORM_EXPORT BudgetPool {
// on total cpu time.
class BLINK_PLATFORM_EXPORT CPUTimeBudgetPool : public BudgetPool {
public:
+ CPUTimeBudgetPool(const char* name,
+ TaskQueueThrottler* task_queue_throttler,
+ base::TimeTicks now,
+ base::Optional<base::TimeDelta> max_budget_level,
+ base::Optional<base::TimeDelta> max_throttling_duration);
+
~CPUTimeBudgetPool();
// Throttle task queues from this time budget pool if tasks are running
@@ -105,6 +114,7 @@ class BLINK_PLATFORM_EXPORT CPUTimeBudgetPool : public BudgetPool {
bool IsThrottlingEnabled() const override;
void RecordTaskRunTime(base::TimeTicks start_time,
base::TimeTicks end_time) override;
+ void BlockThrottledQueues(base::TimeTicks now) override;
void Close() override;
bool HasEnoughBudgetToRun(base::TimeTicks now) override;
base::TimeTicks GetNextAllowedRunTime() override;
@@ -112,23 +122,12 @@ class BLINK_PLATFORM_EXPORT CPUTimeBudgetPool : public BudgetPool {
base::TimeTicks now) const override;
private:
- friend class TaskQueueThrottler;
-
FRIEND_TEST_ALL_PREFIXES(TaskQueueThrottlerTest, CPUTimeBudgetPool);
- CPUTimeBudgetPool(const char* name,
- TaskQueueThrottler* task_queue_throttler,
- base::TimeTicks now,
- base::Optional<base::TimeDelta> max_budget_level,
- base::Optional<base::TimeDelta> max_throttling_duration);
-
// Advances |last_checkpoint_| to |now| if needed and recalculates
// budget level.
void Advance(base::TimeTicks now);
- // Disable all associated throttled queues.
- void BlockThrottledQueues(base::TimeTicks now);
-
// Increase |current_budget_level_| to satisfy max throttling duration
// condition if necessary.
// Decrease |current_budget_level_| to satisfy max budget level

Powered by Google App Engine
This is Rietveld 408576698