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

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

Issue 2915993003: Revert of [scheduler] Change TaskQueue observer call mechanism. (Closed)
Patch Set: Created 3 years, 6 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.
43 virtual void OnQueueNextWakeUpChanged(TaskQueue* queue, 40 virtual void OnQueueNextWakeUpChanged(TaskQueue* queue,
44 base::TimeTicks next_wake_up) = 0; 41 base::TimeTicks next_wake_up) = 0;
45 }; 42 };
46 43
47 // Unregisters the task queue after which no tasks posted to it will run and 44 // Unregisters the task queue after which no tasks posted to it will run and
48 // the TaskQueueManager's reference to it will be released soon. 45 // the TaskQueueManager's reference to it will be released soon.
49 virtual void UnregisterTaskQueue() = 0; 46 virtual void UnregisterTaskQueue() = 0;
50 47
51 enum QueuePriority { 48 enum QueuePriority {
52 // Queues with control priority will run before any other queue, and will 49 // Queues with control priority will run before any other queue, and will
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 virtual bool IsQueueEnabled() const = 0; 155 virtual bool IsQueueEnabled() const = 0;
159 156
160 // Returns true if the queue is completely empty. 157 // Returns true if the queue is completely empty.
161 virtual bool IsEmpty() const = 0; 158 virtual bool IsEmpty() const = 0;
162 159
163 // Returns the number of pending tasks in the queue. 160 // Returns the number of pending tasks in the queue.
164 virtual size_t GetNumberOfPendingTasks() const = 0; 161 virtual size_t GetNumberOfPendingTasks() const = 0;
165 162
166 // Returns true if the queue has work that's ready to execute now. 163 // Returns true if the queue has work that's ready to execute now.
167 // NOTE: this must be called on the thread this TaskQueue was created by. 164 // NOTE: this must be called on the thread this TaskQueue was created by.
168 virtual bool HasTaskToRunImmediately() const = 0; 165 virtual bool HasPendingImmediateWork() const = 0;
169 166
170 // Returns requested run time of next scheduled wake-up for a delayed task 167 // Returns requested run time of next scheduled wake-up for a delayed task
171 // which is not ready to run. If there are no such tasks or the queue is 168 // which is not ready to run. If there are no such tasks or the queue is
172 // disabled (by a QueueEnabledVoter) it returns base::nullopt. 169 // disabled (by a QueueEnabledVoter) it returns base::nullopt.
173 // NOTE: this must be called on the thread this TaskQueue was created by. 170 // NOTE: this must be called on the thread this TaskQueue was created by.
174 virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0; 171 virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0;
175 172
176 // Can be called on any thread. 173 // Can be called on any thread.
177 virtual QueueType GetQueueType() const = 0; 174 virtual QueueType GetQueueType() const = 0;
178 175
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 protected: 230 protected:
234 ~TaskQueue() override {} 231 ~TaskQueue() override {}
235 232
236 DISALLOW_COPY_AND_ASSIGN(TaskQueue); 233 DISALLOW_COPY_AND_ASSIGN(TaskQueue);
237 }; 234 };
238 235
239 } // namespace scheduler 236 } // namespace scheduler
240 } // namespace blink 237 } // namespace blink
241 238
242 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ 239 #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