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

Unified Diff: components/scheduler/renderer/throttling_helper.h

Issue 2080563003: (Merge m52) Fix a bug with throttling and timer queue suspension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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/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();
« no previous file with comments | « components/scheduler/renderer/renderer_scheduler_impl_unittest.cc ('k') | components/scheduler/renderer/throttling_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698