Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue.h

Issue 2808843003: [scheduler] Change TaskQueue observer call mechanism. (Closed)
Patch Set: Fix compilation Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ 6 #define THIRD_PARTY_WEBKIT_SOURCE_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"
(...skipping 19 matching lines...) Expand all
30 class PLATFORM_EXPORT Observer { 30 class PLATFORM_EXPORT Observer {
31 public: 31 public:
32 virtual ~Observer() {} 32 virtual ~Observer() {}
33 33
34 // Notify observer that the time at which this queue wants to run 34 // Notify observer that the time at which this queue wants to run
35 // the next task has changed. |next_wakeup| can be in the past 35 // the next task has changed. |next_wakeup| can be in the past
36 // (e.g. base::TimeTicks() can be used to notify about immediate work). 36 // (e.g. base::TimeTicks() can be used to notify about immediate work).
37 // Can be called on any thread 37 // Can be called on any thread
38 // All methods but SetObserver, SetTimeDomain and GetTimeDomain can be 38 // All methods but SetObserver, SetTimeDomain and GetTimeDomain can be
39 // called on |queue|. 39 // called on |queue|.
40 //
41 // TODO(altimin): Make it base::Optional<base::TimeTicks> to tell
42 // observer about cancellations.
40 virtual void OnQueueNextWakeUpChanged(TaskQueue* queue, 43 virtual void OnQueueNextWakeUpChanged(TaskQueue* queue,
41 base::TimeTicks next_wake_up) = 0; 44 base::TimeTicks next_wake_up) = 0;
42 }; 45 };
43 46
44 // Unregisters the task queue after which no tasks posted to it will run and 47 // Unregisters the task queue after which no tasks posted to it will run and
45 // the TaskQueueManager's reference to it will be released soon. 48 // the TaskQueueManager's reference to it will be released soon.
46 virtual void UnregisterTaskQueue() = 0; 49 virtual void UnregisterTaskQueue() = 0;
47 50
48 enum QueuePriority { 51 enum QueuePriority {
49 // Queues with control priority will run before any other queue, and will 52 // Queues with control priority will run before any other queue, and will
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 virtual bool IsQueueEnabled() const = 0; 158 virtual bool IsQueueEnabled() const = 0;
156 159
157 // Returns true if the queue is completely empty. 160 // Returns true if the queue is completely empty.
158 virtual bool IsEmpty() const = 0; 161 virtual bool IsEmpty() const = 0;
159 162
160 // Returns the number of pending tasks in the queue. 163 // Returns the number of pending tasks in the queue.
161 virtual size_t GetNumberOfPendingTasks() const = 0; 164 virtual size_t GetNumberOfPendingTasks() const = 0;
162 165
163 // Returns true if the queue has work that's ready to execute now. 166 // Returns true if the queue has work that's ready to execute now.
164 // NOTE: this must be called on the thread this TaskQueue was created by. 167 // NOTE: this must be called on the thread this TaskQueue was created by.
165 virtual bool HasPendingImmediateWork() const = 0; 168 virtual bool HasTaskToRunImmediately() const = 0;
166 169
167 // Returns requested run time of next scheduled wake-up for a delayed task 170 // Returns requested run time of next scheduled wake-up for a delayed task
168 // which is not ready to run. If there are no such tasks or the queue is 171 // which is not ready to run. If there are no such tasks or the queue is
169 // disabled (by a QueueEnabledVoter) it returns base::nullopt. 172 // disabled (by a QueueEnabledVoter) it returns base::nullopt.
170 // NOTE: this must be called on the thread this TaskQueue was created by. 173 // NOTE: this must be called on the thread this TaskQueue was created by.
171 virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0; 174 virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0;
172 175
173 // Can be called on any thread. 176 // Can be called on any thread.
174 virtual QueueType GetQueueType() const = 0; 177 virtual QueueType GetQueueType() const = 0;
175 178
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 protected: 233 protected:
231 ~TaskQueue() override {} 234 ~TaskQueue() override {}
232 235
233 DISALLOW_COPY_AND_ASSIGN(TaskQueue); 236 DISALLOW_COPY_AND_ASSIGN(TaskQueue);
234 }; 237 };
235 238
236 } // namespace scheduler 239 } // namespace scheduler
237 } // namespace blink 240 } // namespace blink
238 241
239 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ 242 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698