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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h

Issue 2345483002: [scheduler] Throttle background frames with 1% CPU limit (Closed)
Patch Set: Rebased Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELPER_ H_ 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELPER_ H_
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELPER_ H_ 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELPER_ H_
7 7
8 #include <set> 8 #include <set>
9 #include <unordered_map> 9 #include <unordered_map>
10 10
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 : throttling_ref_count(ref_count), 191 : throttling_ref_count(ref_count),
192 enabled(is_enabled), 192 enabled(is_enabled),
193 time_budget_pool(nullptr) {} 193 time_budget_pool(nullptr) {}
194 194
195 size_t throttling_ref_count; 195 size_t throttling_ref_count;
196 bool enabled; 196 bool enabled;
197 197
198 TimeBudgetPool* time_budget_pool; 198 TimeBudgetPool* time_budget_pool;
199 199
200 bool IsThrottled() const { return throttling_ref_count > 0; } 200 bool IsThrottled() const { return throttling_ref_count > 0; }
201
202 void SetQueueEnabled(TaskQueue* task_queue);
201 }; 203 };
202 using TaskQueueMap = std::unordered_map<TaskQueue*, Metadata>; 204 using TaskQueueMap = std::unordered_map<TaskQueue*, Metadata>;
203 205
204 void PumpThrottledTasks(); 206 void PumpThrottledTasks();
205 207
206 // Note |unthrottled_runtime| might be in the past. When this happens we 208 // Note |unthrottled_runtime| might be in the past. When this happens we
207 // compute the delay to the next runtime based on now rather than 209 // compute the delay to the next runtime based on now rather than
208 // unthrottled_runtime. 210 // unthrottled_runtime.
209 void MaybeSchedulePumpThrottledTasks( 211 void MaybeSchedulePumpThrottledTasks(
210 const tracked_objects::Location& from_here, 212 const tracked_objects::Location& from_here,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 245
244 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; 246 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_;
245 247
246 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); 248 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler);
247 }; 249 };
248 250
249 } // namespace scheduler 251 } // namespace scheduler
250 } // namespace blink 252 } // namespace blink
251 253
252 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP ER_H_ 254 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698