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 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/optional.h" | 13 #include "base/optional.h" |
14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
15 #include "platform/PlatformExport.h" | 15 #include "platform/PlatformExport.h" |
16 #include "platform/scheduler/base/cancelable_closure_holder.h" | 16 #include "platform/scheduler/base/cancelable_closure_holder.h" |
17 #include "platform/scheduler/base/time_domain.h" | 17 #include "platform/scheduler/base/time_domain.h" |
18 #include "platform/scheduler/renderer/budget_pool.h" | 18 #include "platform/scheduler/renderer/budget_pool.h" |
19 #include "platform/scheduler/renderer/cpu_time_budget_pool.h" | 19 #include "platform/scheduler/renderer/cpu_time_budget_pool.h" |
20 #include "platform/scheduler/renderer/wake_up_budget_pool.h" | 20 #include "platform/scheduler/renderer/wake_up_budget_pool.h" |
21 #include "platform/scheduler/renderer/web_view_scheduler.h" | 21 #include "platform/scheduler/renderer/web_view_scheduler.h" |
22 | 22 |
23 namespace base { | 23 namespace base { |
24 namespace trace_event { | 24 namespace trace_event { |
25 class TracedValue; | 25 class TracedValue; |
26 } | 26 } |
27 } | 27 } // namespace base |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 namespace scheduler { | 30 namespace scheduler { |
31 | 31 |
32 class BudgetPool; | 32 class BudgetPool; |
33 class RendererSchedulerImpl; | 33 class RendererSchedulerImpl; |
34 class ThrottledTimeDomain; | 34 class ThrottledTimeDomain; |
35 class CPUTimeBudgetPool; | 35 class CPUTimeBudgetPool; |
36 class WakeUpBudgetPool; | 36 class WakeUpBudgetPool; |
37 | 37 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 CPUTimeBudgetPool* CreateCPUTimeBudgetPool(const char* name); | 144 CPUTimeBudgetPool* CreateCPUTimeBudgetPool(const char* name); |
145 WakeUpBudgetPool* CreateWakeUpBudgetPool(const char* name); | 145 WakeUpBudgetPool* CreateWakeUpBudgetPool(const char* name); |
146 | 146 |
147 // Accounts for given task for cpu-based throttling needs. | 147 // Accounts for given task for cpu-based throttling needs. |
148 void OnTaskRunTimeReported(TaskQueue* task_queue, | 148 void OnTaskRunTimeReported(TaskQueue* task_queue, |
149 base::TimeTicks start_time, | 149 base::TimeTicks start_time, |
150 base::TimeTicks end_time); | 150 base::TimeTicks end_time); |
151 | 151 |
152 void AsValueInto(base::trace_event::TracedValue* state, | 152 void AsValueInto(base::trace_event::TracedValue* state, |
153 base::TimeTicks now) const; | 153 base::TimeTicks now) const; |
| 154 |
154 private: | 155 private: |
155 struct Metadata { | 156 struct Metadata { |
156 Metadata() : throttling_ref_count(0) {} | 157 Metadata() : throttling_ref_count(0) {} |
157 | 158 |
158 size_t throttling_ref_count; | 159 size_t throttling_ref_count; |
159 | 160 |
160 std::unordered_set<BudgetPool*> budget_pools; | 161 std::unordered_set<BudgetPool*> budget_pools; |
161 }; | 162 }; |
162 using TaskQueueMap = std::unordered_map<TaskQueue*, Metadata>; | 163 using TaskQueueMap = std::unordered_map<TaskQueue*, Metadata>; |
163 | 164 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 204 |
204 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; | 205 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; |
205 | 206 |
206 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); | 207 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); |
207 }; | 208 }; |
208 | 209 |
209 } // namespace scheduler | 210 } // namespace scheduler |
210 } // namespace blink | 211 } // namespace blink |
211 | 212 |
212 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_TASK_QUEUE_THRO
TTLER_H_ | 213 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_TASK_QUEUE_THRO
TTLER_H_ |
OLD | NEW |