| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 class BLINK_PLATFORM_EXPORT TaskQueueManager | 55 class BLINK_PLATFORM_EXPORT TaskQueueManager |
| 56 : public internal::TaskQueueSelector::Observer, | 56 : public internal::TaskQueueSelector::Observer, |
| 57 public base::MessageLoop::NestingObserver { | 57 public base::MessageLoop::NestingObserver { |
| 58 public: | 58 public: |
| 59 // Create a task queue manager where |delegate| identifies the thread | 59 // Create a task queue manager where |delegate| identifies the thread |
| 60 // on which where the tasks are eventually run. Category strings must have | 60 // on which where the tasks are eventually run. Category strings must have |
| 61 // application lifetime (statics or literals). They may not include " chars. | 61 // application lifetime (statics or literals). They may not include " chars. |
| 62 TaskQueueManager(scoped_refptr<TaskQueueManagerDelegate> delegate, | 62 TaskQueueManager(scoped_refptr<TaskQueueManagerDelegate> delegate, |
| 63 const char* tracing_category, | 63 const char* tracing_category, |
| 64 const char* disabled_by_default_tracing_category, | 64 const char* disabled_by_default_tracing_category, |
| 65 const char* disabled_by_default_verbose_tracing_category, | 65 const char* disabled_by_default_verbose_tracing_category); |
| 66 bool set_crash_keys = false); | |
| 67 ~TaskQueueManager() override; | 66 ~TaskQueueManager() override; |
| 68 | 67 |
| 69 // Requests that a task to process work is posted on the main task runner. | 68 // Requests that a task to process work is posted on the main task runner. |
| 70 // These tasks are de-duplicated in two buckets: main-thread and all other | 69 // These tasks are de-duplicated in two buckets: main-thread and all other |
| 71 // threads. This distinction is done to reduce the overehead from locks, we | 70 // threads. This distinction is done to reduce the overehead from locks, we |
| 72 // assume the main-thread path will be hot. | 71 // assume the main-thread path will be hot. |
| 73 void MaybeScheduleImmediateWork(const tracked_objects::Location& from_here); | 72 void MaybeScheduleImmediateWork(const tracked_objects::Location& from_here); |
| 74 | 73 |
| 75 // Requests that a delayed task to process work is posted on the main task | 74 // Requests that a delayed task to process work is posted on the main task |
| 76 // runner. These delayed tasks are de-duplicated. Must be called on the thread | 75 // runner. These delayed tasks are de-duplicated. Must be called on the thread |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 bool task_was_run_on_quiescence_monitored_queue_; | 234 bool task_was_run_on_quiescence_monitored_queue_; |
| 236 | 235 |
| 237 // To reduce locking overhead we track pending calls to DoWork separately for | 236 // To reduce locking overhead we track pending calls to DoWork separately for |
| 238 // the main thread and other threads. | 237 // the main thread and other threads. |
| 239 std::set<base::TimeTicks> main_thread_pending_wakeups_; | 238 std::set<base::TimeTicks> main_thread_pending_wakeups_; |
| 240 | 239 |
| 241 // Protects |other_thread_pending_wakeup_|. | 240 // Protects |other_thread_pending_wakeup_|. |
| 242 mutable base::Lock other_thread_lock_; | 241 mutable base::Lock other_thread_lock_; |
| 243 bool other_thread_pending_wakeup_; | 242 bool other_thread_pending_wakeup_; |
| 244 | 243 |
| 245 bool set_crash_keys_; | |
| 246 | |
| 247 int work_batch_size_; | 244 int work_batch_size_; |
| 248 size_t task_count_; | 245 size_t task_count_; |
| 249 | 246 |
| 250 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; | 247 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; |
| 251 | 248 |
| 252 base::ObserverList<TaskTimeObserver> task_time_observers_; | 249 base::ObserverList<TaskTimeObserver> task_time_observers_; |
| 253 | 250 |
| 254 const char* tracing_category_; | 251 const char* tracing_category_; |
| 255 const char* disabled_by_default_tracing_category_; | 252 const char* disabled_by_default_tracing_category_; |
| 256 const char* disabled_by_default_verbose_tracing_category_; | 253 const char* disabled_by_default_verbose_tracing_category_; |
| 257 | 254 |
| 258 internal::TaskQueueImpl* currently_executing_task_queue_; // NOT OWNED | 255 internal::TaskQueueImpl* currently_executing_task_queue_; // NOT OWNED |
| 259 | 256 |
| 260 Observer* observer_; // NOT OWNED | 257 Observer* observer_; // NOT OWNED |
| 261 scoped_refptr<DeletionSentinel> deletion_sentinel_; | 258 scoped_refptr<DeletionSentinel> deletion_sentinel_; |
| 262 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 259 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
| 263 | 260 |
| 264 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 261 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
| 265 }; | 262 }; |
| 266 | 263 |
| 267 } // namespace scheduler | 264 } // namespace scheduler |
| 268 } // namespace blink | 265 } // namespace blink |
| 269 | 266 |
| 270 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_
H_ | 267 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_
H_ |
| OLD | NEW |