| OLD | NEW |
| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 Metadata(size_t ref_count, bool is_enabled) | 228 Metadata(size_t ref_count, bool is_enabled) |
| 229 : throttling_ref_count(ref_count), | 229 : throttling_ref_count(ref_count), |
| 230 enabled(is_enabled), | 230 enabled(is_enabled), |
| 231 time_budget_pool(nullptr) {} | 231 time_budget_pool(nullptr) {} |
| 232 | 232 |
| 233 size_t throttling_ref_count; | 233 size_t throttling_ref_count; |
| 234 bool enabled; | 234 bool enabled; |
| 235 | 235 |
| 236 TimeBudgetPool* time_budget_pool; | 236 TimeBudgetPool* time_budget_pool; |
| 237 | 237 |
| 238 bool IsThrottled() const { return throttling_ref_count > 0; } | |
| 239 | |
| 240 void SetQueueEnabled(TaskQueue* task_queue); | 238 void SetQueueEnabled(TaskQueue* task_queue); |
| 241 }; | 239 }; |
| 242 using TaskQueueMap = std::unordered_map<TaskQueue*, Metadata>; | 240 using TaskQueueMap = std::unordered_map<TaskQueue*, Metadata>; |
| 243 | 241 |
| 244 void PumpThrottledTasks(); | 242 void PumpThrottledTasks(); |
| 245 | 243 |
| 246 // Note |unthrottled_runtime| might be in the past. When this happens we | 244 // Note |unthrottled_runtime| might be in the past. When this happens we |
| 247 // compute the delay to the next runtime based on now rather than | 245 // compute the delay to the next runtime based on now rather than |
| 248 // unthrottled_runtime. | 246 // unthrottled_runtime. |
| 249 void MaybeSchedulePumpThrottledTasks( | 247 void MaybeSchedulePumpThrottledTasks( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 281 |
| 284 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; | 282 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; |
| 285 | 283 |
| 286 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); | 284 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); |
| 287 }; | 285 }; |
| 288 | 286 |
| 289 } // namespace scheduler | 287 } // namespace scheduler |
| 290 } // namespace blink | 288 } // namespace blink |
| 291 | 289 |
| 292 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP
ER_H_ | 290 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP
ER_H_ |
| OLD | NEW |