| 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ |
| 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 // Return number of pending tasks in task queues. | 137 // Return number of pending tasks in task queues. |
| 138 size_t GetNumberOfPendingTasks() const; | 138 size_t GetNumberOfPendingTasks() const; |
| 139 | 139 |
| 140 // Returns true if there is a task that could be executed immediately. | 140 // Returns true if there is a task that could be executed immediately. |
| 141 bool HasImmediateWorkForTesting() const; | 141 bool HasImmediateWorkForTesting() const; |
| 142 | 142 |
| 143 // Removes all canceled delayed tasks. | 143 // Removes all canceled delayed tasks. |
| 144 void SweepCanceledDelayedTasks(); | 144 void SweepCanceledDelayedTasks(); |
| 145 | 145 |
| 146 // There is a small overhead to recording task delay histograms. If you don't |
| 147 // need them, you can turn them off. |
| 148 void SetRecordTaskDelayHistograms(bool record_task_delay_histograms); |
| 149 |
| 146 private: | 150 private: |
| 147 friend class LazyNow; | 151 friend class LazyNow; |
| 148 friend class internal::TaskQueueImpl; | 152 friend class internal::TaskQueueImpl; |
| 149 friend class TaskQueueManagerTest; | 153 friend class TaskQueueManagerTest; |
| 150 | 154 |
| 151 class DeletionSentinel : public base::RefCounted<DeletionSentinel> { | 155 class DeletionSentinel : public base::RefCounted<DeletionSentinel> { |
| 152 private: | 156 private: |
| 153 friend class base::RefCounted<DeletionSentinel>; | 157 friend class base::RefCounted<DeletionSentinel>; |
| 154 ~DeletionSentinel() {} | 158 ~DeletionSentinel() {} |
| 155 }; | 159 }; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 bool task_was_run_on_quiescence_monitored_queue_; | 243 bool task_was_run_on_quiescence_monitored_queue_; |
| 240 | 244 |
| 241 // To reduce locking overhead we track pending calls to DoWork separately for | 245 // To reduce locking overhead we track pending calls to DoWork separately for |
| 242 // the main thread and other threads. | 246 // the main thread and other threads. |
| 243 std::set<base::TimeTicks> main_thread_pending_wakeups_; | 247 std::set<base::TimeTicks> main_thread_pending_wakeups_; |
| 244 | 248 |
| 245 // Protects |other_thread_pending_wakeup_|. | 249 // Protects |other_thread_pending_wakeup_|. |
| 246 mutable base::Lock other_thread_lock_; | 250 mutable base::Lock other_thread_lock_; |
| 247 bool other_thread_pending_wakeup_; | 251 bool other_thread_pending_wakeup_; |
| 248 | 252 |
| 253 bool record_task_delay_histograms_; |
| 254 |
| 249 int work_batch_size_; | 255 int work_batch_size_; |
| 250 size_t task_count_; | 256 size_t task_count_; |
| 251 | 257 |
| 252 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; | 258 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; |
| 253 | 259 |
| 254 base::ObserverList<TaskTimeObserver> task_time_observers_; | 260 base::ObserverList<TaskTimeObserver> task_time_observers_; |
| 255 | 261 |
| 256 const char* tracing_category_; | 262 const char* tracing_category_; |
| 257 const char* disabled_by_default_tracing_category_; | 263 const char* disabled_by_default_tracing_category_; |
| 258 const char* disabled_by_default_verbose_tracing_category_; | 264 const char* disabled_by_default_verbose_tracing_category_; |
| 259 | 265 |
| 260 internal::TaskQueueImpl* currently_executing_task_queue_; // NOT OWNED | 266 internal::TaskQueueImpl* currently_executing_task_queue_; // NOT OWNED |
| 261 | 267 |
| 262 Observer* observer_; // NOT OWNED | 268 Observer* observer_; // NOT OWNED |
| 263 scoped_refptr<DeletionSentinel> deletion_sentinel_; | 269 scoped_refptr<DeletionSentinel> deletion_sentinel_; |
| 264 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 270 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
| 265 | 271 |
| 266 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 272 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
| 267 }; | 273 }; |
| 268 | 274 |
| 269 } // namespace scheduler | 275 } // namespace scheduler |
| 270 } // namespace blink | 276 } // namespace blink |
| 271 | 277 |
| 272 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_
H_ | 278 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_
H_ |
| OLD | NEW |