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 // Unregisters a TaskQueue previously created by |NewTaskQueue()|. | |
| 92 // NOTE we have to flush the queue from |newly_updatable_| which means as a | |
| 93 // side effect MoveNewlyUpdatableQueuesIntoUpdatableQueueSet is called by this | |
| 94 // function. | |
| 95 void UnregisterTaskQueue(scoped_refptr<internal::TaskQueueImpl> task_queue); | |
|
Sami
2015/09/10 12:51:58
Could this method be on the TaskQueue instead?
ni
alex clarke (OOO till 29th)
2015/09/10 14:35:58
Yes, DONE.
| |
| 96 | |
| 91 private: | 97 private: |
| 92 friend class internal::LazyNow; | 98 friend class internal::LazyNow; |
| 93 friend class internal::TaskQueueImpl; | 99 friend class internal::TaskQueueImpl; |
| 94 friend class TaskQueueManagerTest; | 100 friend class TaskQueueManagerTest; |
| 95 | 101 |
| 96 class DeletionSentinel : public base::RefCounted<DeletionSentinel> { | 102 class DeletionSentinel : public base::RefCounted<DeletionSentinel> { |
| 97 private: | 103 private: |
| 98 friend class base::RefCounted<DeletionSentinel>; | 104 friend class base::RefCounted<DeletionSentinel>; |
| 99 ~DeletionSentinel() {} | 105 ~DeletionSentinel() {} |
| 100 }; | 106 }; |
| 101 | 107 |
| 102 // Unregisters a TaskQueue previously created by |NewTaskQueue()|. | |
| 103 // NOTE we have to flush the queue from |newly_updatable_| which means as a | |
| 104 // side effect MoveNewlyUpdatableQueuesIntoUpdatableQueueSet is called by this | |
| 105 // function. | |
| 106 void UnregisterTaskQueue(scoped_refptr<internal::TaskQueueImpl> task_queue); | |
| 107 | |
| 108 // TaskQueueSelector::Observer implementation: | 108 // TaskQueueSelector::Observer implementation: |
| 109 void OnTaskQueueEnabled(internal::TaskQueueImpl* queue) override; | 109 void OnTaskQueueEnabled(internal::TaskQueueImpl* queue) override; |
| 110 | 110 |
| 111 // Called by the task queue to register a new pending task. | 111 // Called by the task queue to register a new pending task. |
| 112 void DidQueueTask(const internal::TaskQueueImpl::Task& pending_task); | 112 void DidQueueTask(const internal::TaskQueueImpl::Task& pending_task); |
| 113 | 113 |
| 114 // Post a task to call DoWork() on the main task runner. Only one pending | 114 // Post a task to call DoWork() on the main task runner. Only one pending |
| 115 // DoWork is allowed from the main thread, to prevent an explosion of pending | 115 // DoWork is allowed from the main thread, to prevent an explosion of pending |
| 116 // DoWorks. | 116 // DoWorks. |
| 117 void MaybePostDoWorkOnMainRunner(); | 117 void MaybePostDoWorkOnMainRunner(); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 233 |
| 234 scoped_refptr<DeletionSentinel> deletion_sentinel_; | 234 scoped_refptr<DeletionSentinel> deletion_sentinel_; |
| 235 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 235 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
| 236 | 236 |
| 237 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 237 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
| 238 }; | 238 }; |
| 239 | 239 |
| 240 } // namespace scheduler | 240 } // namespace scheduler |
| 241 | 241 |
| 242 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ | 242 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ |
| OLD | NEW |