| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 : throttling_ref_count(ref_count), | 195 : throttling_ref_count(ref_count), |
| 196 enabled(is_enabled), | 196 enabled(is_enabled), |
| 197 time_budget_pool(nullptr) {} | 197 time_budget_pool(nullptr) {} |
| 198 | 198 |
| 199 size_t throttling_ref_count; | 199 size_t throttling_ref_count; |
| 200 bool enabled; | 200 bool enabled; |
| 201 | 201 |
| 202 TimeBudgetPool* time_budget_pool; | 202 TimeBudgetPool* time_budget_pool; |
| 203 | 203 |
| 204 bool IsThrottled() const { return throttling_ref_count > 0; } | 204 bool IsThrottled() const { return throttling_ref_count > 0; } |
| 205 | |
| 206 void SetQueueEnabled(TaskQueue* task_queue); | |
| 207 }; | 205 }; |
| 208 using TaskQueueMap = std::unordered_map<TaskQueue*, Metadata>; | 206 using TaskQueueMap = std::unordered_map<TaskQueue*, Metadata>; |
| 209 | 207 |
| 210 void PumpThrottledTasks(); | 208 void PumpThrottledTasks(); |
| 211 | 209 |
| 212 // Note |unthrottled_runtime| might be in the past. When this happens we | 210 // Note |unthrottled_runtime| might be in the past. When this happens we |
| 213 // compute the delay to the next runtime based on now rather than | 211 // compute the delay to the next runtime based on now rather than |
| 214 // unthrottled_runtime. | 212 // unthrottled_runtime. |
| 215 void MaybeSchedulePumpThrottledTasks( | 213 void MaybeSchedulePumpThrottledTasks( |
| 216 const tracked_objects::Location& from_here, | 214 const tracked_objects::Location& from_here, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 247 |
| 250 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; | 248 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; |
| 251 | 249 |
| 252 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); | 250 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); |
| 253 }; | 251 }; |
| 254 | 252 |
| 255 } // namespace scheduler | 253 } // namespace scheduler |
| 256 } // namespace blink | 254 } // namespace blink |
| 257 | 255 |
| 258 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP
ER_H_ | 256 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP
ER_H_ |
| OLD | NEW |