OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_RENDERER_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ |
6 #define CONTENT_RENDERER_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 // Called once to set the Observer. This function is called on the main | 94 // Called once to set the Observer. This function is called on the main |
95 // thread. If |observer| is null, then no callbacks will occur. | 95 // thread. If |observer| is null, then no callbacks will occur. |
96 // Note |observer| is expected to outlive the SchedulerHelper. | 96 // Note |observer| is expected to outlive the SchedulerHelper. |
97 void SetObserver(Observer* observer); | 97 void SetObserver(Observer* observer); |
98 | 98 |
99 // Returns the delegate used by the TaskQueueManager. | 99 // Returns the delegate used by the TaskQueueManager. |
100 const scoped_refptr<TaskQueueManagerDelegate>& delegate() const; | 100 const scoped_refptr<TaskQueueManagerDelegate>& delegate() const; |
101 | 101 |
102 // Time domains must be registered for the task queues to get updated. | 102 // Time domains must be registered for the task queues to get updated. |
103 void RegisterTimeDomain(const scoped_refptr<TimeDomain>& time_domain); | 103 void RegisterTimeDomain(TimeDomain* time_domain); |
104 void UnregisterTimeDomain(const scoped_refptr<TimeDomain>& time_domain); | 104 void UnregisterTimeDomain(TimeDomain* time_domain); |
105 | 105 |
106 const scoped_refptr<RealTimeDomain>& real_time_domain() const { | 106 RealTimeDomain* real_time_domain() const { return real_time_domain_.get(); } |
107 return real_time_domain_; | |
108 } | |
109 | 107 |
110 private: | 108 private: |
111 friend class LazyNow; | 109 friend class LazyNow; |
112 friend class internal::TaskQueueImpl; | 110 friend class internal::TaskQueueImpl; |
113 friend class TaskQueueManagerTest; | 111 friend class TaskQueueManagerTest; |
114 | 112 |
115 class DeletionSentinel : public base::RefCounted<DeletionSentinel> { | 113 class DeletionSentinel : public base::RefCounted<DeletionSentinel> { |
116 private: | 114 private: |
117 friend class base::RefCounted<DeletionSentinel>; | 115 friend class base::RefCounted<DeletionSentinel>; |
118 ~DeletionSentinel() {} | 116 ~DeletionSentinel() {} |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 base::TimeDelta delay); | 167 base::TimeDelta delay); |
170 | 168 |
171 int GetNextSequenceNumber(); | 169 int GetNextSequenceNumber(); |
172 | 170 |
173 bool TryAdvanceTimeDomains(); | 171 bool TryAdvanceTimeDomains(); |
174 | 172 |
175 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 173 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
176 AsValueWithSelectorResult(bool should_run, | 174 AsValueWithSelectorResult(bool should_run, |
177 internal::TaskQueueImpl* selected_queue) const; | 175 internal::TaskQueueImpl* selected_queue) const; |
178 | 176 |
179 std::set<scoped_refptr<TimeDomain>> time_domains_; | 177 std::set<TimeDomain*> time_domains_; |
180 scoped_refptr<RealTimeDomain> real_time_domain_; | 178 scoped_ptr<RealTimeDomain> real_time_domain_; |
181 | 179 |
182 std::set<scoped_refptr<internal::TaskQueueImpl>> queues_; | 180 std::set<scoped_refptr<internal::TaskQueueImpl>> queues_; |
183 | 181 |
184 // We have to be careful when deleting a queue because some of the code uses | 182 // We have to be careful when deleting a queue because some of the code uses |
185 // raw pointers and doesn't expect the rug to be pulled out from underneath. | 183 // raw pointers and doesn't expect the rug to be pulled out from underneath. |
186 std::set<scoped_refptr<internal::TaskQueueImpl>> queues_to_delete_; | 184 std::set<scoped_refptr<internal::TaskQueueImpl>> queues_to_delete_; |
187 | 185 |
188 | 186 |
189 base::AtomicSequenceNumber task_sequence_num_; | 187 base::AtomicSequenceNumber task_sequence_num_; |
190 base::debug::TaskAnnotator task_annotator_; | 188 base::debug::TaskAnnotator task_annotator_; |
(...skipping 14 matching lines...) Expand all Loading... |
205 int work_batch_size_; | 203 int work_batch_size_; |
206 | 204 |
207 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; | 205 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; |
208 | 206 |
209 const char* tracing_category_; | 207 const char* tracing_category_; |
210 const char* disabled_by_default_tracing_category_; | 208 const char* disabled_by_default_tracing_category_; |
211 const char* disabled_by_default_verbose_tracing_category_; | 209 const char* disabled_by_default_verbose_tracing_category_; |
212 | 210 |
213 Observer* observer_; // NOT OWNED | 211 Observer* observer_; // NOT OWNED |
214 scoped_refptr<DeletionSentinel> deletion_sentinel_; | 212 scoped_refptr<DeletionSentinel> deletion_sentinel_; |
215 scoped_refptr<TimeDomain> time_domain_; | |
216 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 213 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
217 | 214 |
218 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 215 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
219 }; | 216 }; |
220 | 217 |
221 } // namespace scheduler | 218 } // namespace scheduler |
222 | 219 |
223 #endif // CONTENT_RENDERER_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ | 220 #endif // CONTENT_RENDERER_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ |
OLD | NEW |