| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // sub queues: | 44 // sub queues: |
| 45 // | 45 // |
| 46 // 1. Incoming task queue. Tasks that are posted get immediately appended here. | 46 // 1. Incoming task queue. Tasks that are posted get immediately appended here. |
| 47 // When a task is appended into an empty incoming queue, the task manager | 47 // When a task is appended into an empty incoming queue, the task manager |
| 48 // work function (DoWork) is scheduled to run on the main task runner. | 48 // work function (DoWork) is scheduled to run on the main task runner. |
| 49 // | 49 // |
| 50 // 2. Work queue. If a work queue is empty when DoWork() is entered, tasks from | 50 // 2. Work queue. If a work queue is empty when DoWork() is entered, tasks from |
| 51 // the incoming task queue (if any) are moved here. The work queues are | 51 // the incoming task queue (if any) are moved here. The work queues are |
| 52 // registered with the selector as input to the scheduling decision. | 52 // registered with the selector as input to the scheduling decision. |
| 53 // | 53 // |
| 54 class BLINK_PLATFORM_EXPORT TaskQueueManager | 54 class PLATFORM_EXPORT TaskQueueManager |
| 55 : public internal::TaskQueueSelector::Observer, | 55 : public internal::TaskQueueSelector::Observer, |
| 56 public base::MessageLoop::NestingObserver { | 56 public base::MessageLoop::NestingObserver { |
| 57 public: | 57 public: |
| 58 // Create a task queue manager where |delegate| identifies the thread | 58 // Create a task queue manager where |delegate| identifies the thread |
| 59 // on which where the tasks are eventually run. Category strings must have | 59 // on which where the tasks are eventually run. Category strings must have |
| 60 // application lifetime (statics or literals). They may not include " chars. | 60 // application lifetime (statics or literals). They may not include " chars. |
| 61 TaskQueueManager(scoped_refptr<TaskQueueManagerDelegate> delegate, | 61 TaskQueueManager(scoped_refptr<TaskQueueManagerDelegate> delegate, |
| 62 const char* tracing_category, | 62 const char* tracing_category, |
| 63 const char* disabled_by_default_tracing_category, | 63 const char* disabled_by_default_tracing_category, |
| 64 const char* disabled_by_default_verbose_tracing_category); | 64 const char* disabled_by_default_verbose_tracing_category); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 // Returns true if any task from a monitored task queue was was run since the | 99 // Returns true if any task from a monitored task queue was was run since the |
| 100 // last call to GetAndClearSystemIsQuiescentBit. | 100 // last call to GetAndClearSystemIsQuiescentBit. |
| 101 bool GetAndClearSystemIsQuiescentBit(); | 101 bool GetAndClearSystemIsQuiescentBit(); |
| 102 | 102 |
| 103 // Creates a task queue with the given |spec|. Must be called on the thread | 103 // Creates a task queue with the given |spec|. Must be called on the thread |
| 104 // this class was created on. | 104 // this class was created on. |
| 105 scoped_refptr<internal::TaskQueueImpl> NewTaskQueue( | 105 scoped_refptr<internal::TaskQueueImpl> NewTaskQueue( |
| 106 const TaskQueue::Spec& spec); | 106 const TaskQueue::Spec& spec); |
| 107 | 107 |
| 108 class BLINK_PLATFORM_EXPORT Observer { | 108 class PLATFORM_EXPORT Observer { |
| 109 public: | 109 public: |
| 110 virtual ~Observer() {} | 110 virtual ~Observer() {} |
| 111 | 111 |
| 112 // Called when |queue| is unregistered. | 112 // Called when |queue| is unregistered. |
| 113 virtual void OnUnregisterTaskQueue( | 113 virtual void OnUnregisterTaskQueue( |
| 114 const scoped_refptr<TaskQueue>& queue) = 0; | 114 const scoped_refptr<TaskQueue>& queue) = 0; |
| 115 | 115 |
| 116 // Called when the manager tried to execute a task from a disabled | 116 // Called when the manager tried to execute a task from a disabled |
| 117 // queue. See TaskQueue::Spec::SetShouldReportWhenExecutionBlocked. | 117 // queue. See TaskQueue::Spec::SetShouldReportWhenExecutionBlocked. |
| 118 virtual void OnTriedToExecuteBlockedTask(const TaskQueue& queue, | 118 virtual void OnTriedToExecuteBlockedTask(const TaskQueue& queue, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 scoped_refptr<DeletionSentinel> deletion_sentinel_; | 382 scoped_refptr<DeletionSentinel> deletion_sentinel_; |
| 383 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 383 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
| 384 | 384 |
| 385 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 385 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
| 386 }; | 386 }; |
| 387 | 387 |
| 388 } // namespace scheduler | 388 } // namespace scheduler |
| 389 } // namespace blink | 389 } // namespace blink |
| 390 | 390 |
| 391 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_
H_ | 391 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_
H_ |
| OLD | NEW |