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_TASK_QUEUE_THROTTL
ER_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_TASK_QUEUE_THROTTL
ER_H_ |
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_TASK_QUEUE_THROTTL
ER_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_TASK_QUEUE_THROTTL
ER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void DisableThrottling(); | 121 void DisableThrottling(); |
122 | 122 |
123 // Enable back global throttling. | 123 // Enable back global throttling. |
124 void EnableThrottling(); | 124 void EnableThrottling(); |
125 | 125 |
126 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); } | 126 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); } |
127 | 127 |
128 static base::TimeTicks AlignedThrottledRunTime( | 128 static base::TimeTicks AlignedThrottledRunTime( |
129 base::TimeTicks unthrottled_runtime); | 129 base::TimeTicks unthrottled_runtime); |
130 | 130 |
131 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; } | 131 const scoped_refptr<TaskQueue>& task_queue() const { |
| 132 return control_task_queue_; |
| 133 } |
132 | 134 |
133 // Returned object is owned by |TaskQueueThrottler|. | 135 // Returned object is owned by |TaskQueueThrottler|. |
134 CPUTimeBudgetPool* CreateCPUTimeBudgetPool(const char* name); | 136 CPUTimeBudgetPool* CreateCPUTimeBudgetPool(const char* name); |
135 | 137 |
136 // Accounts for given task for cpu-based throttling needs. | 138 // Accounts for given task for cpu-based throttling needs. |
137 void OnTaskRunTimeReported(TaskQueue* task_queue, | 139 void OnTaskRunTimeReported(TaskQueue* task_queue, |
138 base::TimeTicks start_time, | 140 base::TimeTicks start_time, |
139 base::TimeTicks end_time); | 141 base::TimeTicks end_time); |
140 | 142 |
141 void AsValueInto(base::trace_event::TracedValue* state, | 143 void AsValueInto(base::trace_event::TracedValue* state, |
(...skipping 25 matching lines...) Expand all Loading... |
167 void MaybeDeleteQueueMetadata(TaskQueueMap::iterator it); | 169 void MaybeDeleteQueueMetadata(TaskQueueMap::iterator it); |
168 | 170 |
169 // Schedule a call PumpThrottledTasks at an appropriate moment for this queue. | 171 // Schedule a call PumpThrottledTasks at an appropriate moment for this queue. |
170 void SchedulePumpQueue(const tracked_objects::Location& from_here, | 172 void SchedulePumpQueue(const tracked_objects::Location& from_here, |
171 base::TimeTicks now, | 173 base::TimeTicks now, |
172 TaskQueue* queue); | 174 TaskQueue* queue); |
173 | 175 |
174 TaskQueueMap queue_details_; | 176 TaskQueueMap queue_details_; |
175 base::Callback<void(TaskQueue*, base::TimeTicks)> | 177 base::Callback<void(TaskQueue*, base::TimeTicks)> |
176 forward_immediate_work_callback_; | 178 forward_immediate_work_callback_; |
177 scoped_refptr<TaskQueue> task_runner_; | 179 scoped_refptr<TaskQueue> control_task_queue_; |
178 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED | 180 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED |
179 base::TickClock* tick_clock_; // NOT OWNED | 181 base::TickClock* tick_clock_; // NOT OWNED |
180 const char* tracing_category_; // NOT OWNED | 182 const char* tracing_category_; // NOT OWNED |
181 std::unique_ptr<ThrottledTimeDomain> time_domain_; | 183 std::unique_ptr<ThrottledTimeDomain> time_domain_; |
182 | 184 |
183 CancelableClosureHolder pump_throttled_tasks_closure_; | 185 CancelableClosureHolder pump_throttled_tasks_closure_; |
184 base::Optional<base::TimeTicks> pending_pump_throttled_tasks_runtime_; | 186 base::Optional<base::TimeTicks> pending_pump_throttled_tasks_runtime_; |
185 bool allow_throttling_; | 187 bool allow_throttling_; |
186 | 188 |
187 std::unordered_map<BudgetPool*, std::unique_ptr<BudgetPool>> budget_pools_; | 189 std::unordered_map<BudgetPool*, std::unique_ptr<BudgetPool>> budget_pools_; |
188 | 190 |
189 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; | 191 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; |
190 | 192 |
191 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); | 193 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); |
192 }; | 194 }; |
193 | 195 |
194 } // namespace scheduler | 196 } // namespace scheduler |
195 } // namespace blink | 197 } // namespace blink |
196 | 198 |
197 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_TASK_QUEUE_THRO
TTLER_H_ | 199 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_TASK_QUEUE_THRO
TTLER_H_ |
OLD | NEW |