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

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

Issue 2028433004: Fix a bug with throttling and timer queue suspension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make sure this works in general. Created 4 years, 7 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..d60f4a7c8960ceab6426f3f8f92bdf2359c5a8d0 100644
--- a/components/scheduler/renderer/throttling_helper.h
+++ b/components/scheduler/renderer/throttling_helper.h
@@ -30,6 +30,12 @@ class SCHEDULER_EXPORT ThrottlingHelper : public TimeDomain::Observer {
void OnTimeDomainHasImmediateWork() override;
void OnTimeDomainHasDelayedWork() override;
+ // 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 +55,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();

Powered by Google App Engine
This is Rietveld 408576698