| Index: components/scheduler/renderer/throttling_helper.h
|
| diff --git a/components/scheduler/renderer/throttling_helper.h b/components/scheduler/renderer/throttling_helper.h
|
| index df750757681fcb174d12bdf0809f547bfe867a97..2930f1ba02081d1a8d1bae189c5b4ac6a6410c29 100644
|
| --- a/components/scheduler/renderer/throttling_helper.h
|
| +++ b/components/scheduler/renderer/throttling_helper.h
|
| @@ -30,6 +30,14 @@ class SCHEDULER_EXPORT ThrottlingHelper : public TimeDomain::Observer {
|
| void OnTimeDomainHasImmediateWork() override;
|
| void OnTimeDomainHasDelayedWork() override;
|
|
|
| + // The purpose of this method is to make sure thottling doesn't conflict with
|
| + // enabling/disabling the queue for policy reasons.
|
| + // If |task_queue| is throttled then the ThrottlingHelper remembers the
|
| + // |enabled| setting. In addition if |enabled| is false then the queue is
|
| + // immediatly disabled. Otherwise if |task_queue| not throttled then
|
| + // TaskQueue::SetEnabled(enabled) is called.
|
| + void SetQueueEnabled(TaskQueue* task_queue, bool enabled);
|
| +
|
| // Increments the throttled refcount and causes |task_queue| to be throttled
|
| // if its not already throttled.
|
| void IncreaseThrottleRefCount(TaskQueue* task_queue);
|
| @@ -49,7 +57,16 @@ class SCHEDULER_EXPORT ThrottlingHelper : public TimeDomain::Observer {
|
| const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; }
|
|
|
| private:
|
| - using TaskQueueMap = std::map<TaskQueue*, size_t>;
|
| + struct Metadata {
|
| + Metadata() : throttling_ref_count(0), enabled(false) {}
|
| +
|
| + Metadata(size_t ref_count, bool is_enabled)
|
| + : throttling_ref_count(ref_count), enabled(is_enabled) {}
|
| +
|
| + size_t throttling_ref_count;
|
| + bool enabled;
|
| + };
|
| + using TaskQueueMap = std::map<TaskQueue*, Metadata>;
|
|
|
| void PumpThrottledTasks();
|
|
|
|
|