Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ |
| 6 #define THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ | 6 #define THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/optional.h" | 10 #include "base/optional.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "public/platform/WebCommon.h" | 13 #include "public/platform/WebCommon.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 namespace trace_event { | 16 namespace trace_event { |
| 17 class BlameContext; | 17 class BlameContext; |
| 18 } | 18 } |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 namespace scheduler { | 22 namespace scheduler { |
| 23 | 23 |
| 24 class TimeDomain; | 24 class TimeDomain; |
| 25 | 25 |
| 26 class BLINK_PLATFORM_EXPORT TaskQueue : public base::SingleThreadTaskRunner { | 26 class BLINK_PLATFORM_EXPORT TaskQueue : public base::SingleThreadTaskRunner { |
| 27 public: | 27 public: |
| 28 TaskQueue() {} | 28 TaskQueue() {} |
| 29 | 29 |
| 30 class BLINK_PLATFORM_EXPORT Observer { | |
| 31 public: | |
| 32 virtual ~Observer() {} | |
| 33 | |
| 34 // Notify observer that wakeup has changed. |next_wakeup| can be in the | |
| 35 // past (e.g. base::TimeTicks() can be used to notify about immediate | |
| 36 // work. | |
|
Sami
2017/04/04 19:07:30
Mention which thread this is called on.
Sami
2017/04/05 11:24:00
Also, did we wanna specify which functions can be
altimin
2017/04/05 11:35:58
Done.
altimin
2017/04/05 11:35:58
Done.
| |
| 37 virtual void OnQueueNextWakeupChanged(TaskQueue* queue, | |
| 38 base::TimeTicks next_wakeup) = 0; | |
| 39 }; | |
| 40 | |
| 30 // Unregisters the task queue after which no tasks posted to it will run and | 41 // Unregisters the task queue after which no tasks posted to it will run and |
| 31 // the TaskQueueManager's reference to it will be released soon. | 42 // the TaskQueueManager's reference to it will be released soon. |
| 32 virtual void UnregisterTaskQueue() = 0; | 43 virtual void UnregisterTaskQueue() = 0; |
| 33 | 44 |
| 34 enum QueuePriority { | 45 enum QueuePriority { |
| 35 // Queues with control priority will run before any other queue, and will | 46 // Queues with control priority will run before any other queue, and will |
| 36 // explicitly starve other queues. Typically this should only be used for | 47 // explicitly starve other queues. Typically this should only be used for |
| 37 // private queues which perform control operations. | 48 // private queues which perform control operations. |
| 38 CONTROL_PRIORITY, | 49 CONTROL_PRIORITY, |
| 39 // Queues with high priority will be selected preferentially over normal or | 50 // Queues with high priority will be selected preferentially over normal or |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 // Note: delayed tasks get their enqueue order set once their delay has | 212 // Note: delayed tasks get their enqueue order set once their delay has |
| 202 // expired, and non-delayed tasks get their enqueue order set when posted. | 213 // expired, and non-delayed tasks get their enqueue order set when posted. |
| 203 virtual void InsertFence(InsertFencePosition position) = 0; | 214 virtual void InsertFence(InsertFencePosition position) = 0; |
| 204 | 215 |
| 205 // Removes any previously added fence and unblocks execution of any tasks | 216 // Removes any previously added fence and unblocks execution of any tasks |
| 206 // blocked by it. | 217 // blocked by it. |
| 207 virtual void RemoveFence() = 0; | 218 virtual void RemoveFence() = 0; |
| 208 | 219 |
| 209 virtual bool BlockedByFence() const = 0; | 220 virtual bool BlockedByFence() const = 0; |
| 210 | 221 |
| 222 virtual void AddObserver(Observer* observer) = 0; | |
| 223 virtual void RemoveObserver(Observer* observer) = 0; | |
| 224 | |
| 211 protected: | 225 protected: |
| 212 ~TaskQueue() override {} | 226 ~TaskQueue() override {} |
| 213 | 227 |
| 214 DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 228 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
| 215 }; | 229 }; |
| 216 | 230 |
| 217 } // namespace scheduler | 231 } // namespace scheduler |
| 218 } // namespace blink | 232 } // namespace blink |
| 219 | 233 |
| 220 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ | 234 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ |
| OLD | NEW |