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

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h
index dc36b1c12446eed6579e10f9a21292c8b21031a4..fc20922acf9f2f25d30d021e42658bce175fb55a 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h
@@ -142,7 +142,7 @@ class PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
bool IsQueueEnabled() const override;
bool IsEmpty() const override;
size_t GetNumberOfPendingTasks() const override;
- bool HasPendingImmediateWork() const override;
+ bool HasTaskToRunImmediately() const override;
base::Optional<base::TimeTicks> GetNextScheduledWakeUp() override;
void SetQueuePriority(QueuePriority priority) override;
QueuePriority GetQueuePriority() const override;
@@ -177,6 +177,18 @@ class PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
void NotifyWillProcessTask(const base::PendingTask& pending_task);
void NotifyDidProcessTask(const base::PendingTask& pending_task);
+ // Called by TimeDomain when the wake-up for this queue has changed.
+ // There is only one wake-up, new wake-up cancels any previous wake-ups.
+ // If |scheduled_time_domain_wake_up| is base::nullopt then the wake-up
+ // has been cancelled.
+ // Must be called from the main thread.
+ void SetScheduledTimeDomainWakeUp(
+ base::Optional<base::TimeTicks> scheduled_time_domain_wake_up);
+
+ // Check for available tasks in immediate work queues.
+ // Used to check if we need to generate notifications about delayed work.
+ bool HasPendingImmediateWork();
+
WorkQueue* delayed_work_queue() {
return main_thread_only().delayed_work_queue.get();
}
@@ -202,16 +214,10 @@ class PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
// any. Must be called from the main thread.
base::Optional<DelayedWakeUp> WakeUpForDelayedWork(LazyNow* lazy_now);
- base::TimeTicks scheduled_time_domain_wake_up() const {
+ base::Optional<base::TimeTicks> scheduled_time_domain_wake_up() const {
return main_thread_only().scheduled_time_domain_wake_up;
}
- void set_scheduled_time_domain_wake_up(
- base::TimeTicks scheduled_time_domain_wake_up) {
- main_thread_only().scheduled_time_domain_wake_up =
- scheduled_time_domain_wake_up;
- }
-
HeapHandle heap_handle() const { return main_thread_only().heap_handle; }
void set_heap_handle(HeapHandle heap_handle) {
@@ -285,7 +291,7 @@ class PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
int voter_refcount;
base::trace_event::BlameContext* blame_context; // Not owned.
EnqueueOrder current_fence;
- base::TimeTicks scheduled_time_domain_wake_up;
+ base::Optional<base::TimeTicks> scheduled_time_domain_wake_up;
};
~TaskQueueImpl() override;
@@ -347,8 +353,6 @@ class PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
// Schedules delayed work on time domain and calls the observer.
void ScheduleDelayedWorkInTimeDomain(base::TimeTicks now);
- void NotifyWakeUpChangedOnMainThread(base::TimeTicks wake_up);
-
const base::PlatformThreadId thread_id_;
mutable base::Lock any_thread_lock_;

Powered by Google App Engine
This is Rietveld 408576698