Chromium Code Reviews| 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_TASK_QUEUE_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ |
| 6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 | 81 |
| 82 // Returns true if any task from a monitored task queue was was run since the | 82 // Returns true if any task from a monitored task queue was was run since the |
| 83 // last call to GetAndClearSystemIsQuiescentBit. | 83 // last call to GetAndClearSystemIsQuiescentBit. |
| 84 bool GetAndClearSystemIsQuiescentBit(); | 84 bool GetAndClearSystemIsQuiescentBit(); |
| 85 | 85 |
| 86 // Creates a task queue with the given |spec|. Must be called on the thread | 86 // Creates a task queue with the given |spec|. Must be called on the thread |
| 87 // this class was created on. | 87 // this class was created on. |
| 88 scoped_refptr<internal::TaskQueueImpl> NewTaskQueue( | 88 scoped_refptr<internal::TaskQueueImpl> NewTaskQueue( |
| 89 const TaskQueue::Spec& spec); | 89 const TaskQueue::Spec& spec); |
| 90 | 90 |
| 91 class SCHEDULER_EXPORT Observer { | |
| 92 public: | |
| 93 virtual ~Observer() {} | |
| 94 | |
| 95 // Called when |queue| is unregistered. | |
| 96 virtual void OnUnregisterTaskQueue( | |
| 97 const scoped_refptr<internal::TaskQueueImpl>& queue) = 0; | |
| 98 }; | |
| 99 | |
| 100 // Called once to set the Observer. This function is called on the main | |
| 101 // thread. If |observer| is null, then no callbacks will occur. | |
|
Sami
2015/09/10 15:10:23
nit: also mention the lifetime here.
alex clarke (OOO till 29th)
2015/09/10 15:56:24
Done.
| |
| 102 void SetQueueObserver(Observer* observer); | |
| 103 | |
| 91 private: | 104 private: |
| 92 friend class internal::LazyNow; | 105 friend class internal::LazyNow; |
| 93 friend class internal::TaskQueueImpl; | 106 friend class internal::TaskQueueImpl; |
| 94 friend class TaskQueueManagerTest; | 107 friend class TaskQueueManagerTest; |
| 95 | 108 |
| 96 class DeletionSentinel : public base::RefCounted<DeletionSentinel> { | 109 class DeletionSentinel : public base::RefCounted<DeletionSentinel> { |
| 97 private: | 110 private: |
| 98 friend class base::RefCounted<DeletionSentinel>; | 111 friend class base::RefCounted<DeletionSentinel>; |
| 99 ~DeletionSentinel() {} | 112 ~DeletionSentinel() {} |
| 100 }; | 113 }; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 | 237 |
| 225 int work_batch_size_; | 238 int work_batch_size_; |
| 226 | 239 |
| 227 scoped_ptr<base::TickClock> time_source_; | 240 scoped_ptr<base::TickClock> time_source_; |
| 228 | 241 |
| 229 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; | 242 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; |
| 230 | 243 |
| 231 const char* disabled_by_default_tracing_category_; | 244 const char* disabled_by_default_tracing_category_; |
| 232 const char* disabled_by_default_verbose_tracing_category_; | 245 const char* disabled_by_default_verbose_tracing_category_; |
| 233 | 246 |
| 247 Observer* queue_observer_; // NOT OWNED | |
| 234 scoped_refptr<DeletionSentinel> deletion_sentinel_; | 248 scoped_refptr<DeletionSentinel> deletion_sentinel_; |
| 235 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 249 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
| 236 | 250 |
| 237 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 251 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
| 238 }; | 252 }; |
| 239 | 253 |
| 240 } // namespace scheduler | 254 } // namespace scheduler |
| 241 | 255 |
| 242 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ | 256 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ |
| OLD | NEW |