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

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h

Issue 2812703002: Revert of [scheduler] Add TaskQueue::Observer (Closed)
Patch Set: Manual Revert Created 3 years, 8 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 02be214e55591f00dd7fc00dd2c297678b504743..ec4e74e9a0bfe1587093cc87c25d1d7f3268751a 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
@@ -46,7 +46,7 @@ class WorkQueueSets;
// immediate_work_queue is swapped with immediate_incoming_queue when
// immediate_work_queue becomes empty.
//
-// Delayed tasks are initially posted to delayed_incoming_queue and a wake-up
+// Delayed tasks are initially posted to delayed_incoming_queue and a wakeup
// is scheduled with the TimeDomain. When the delay has elapsed, the TimeDomain
// calls UpdateDelayedWorkQueue and ready delayed tasks are moved into the
// delayed_work_queue. Note the EnqueueOrder (used for ordering) for a delayed
@@ -65,21 +65,6 @@ class BLINK_PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
const char* disabled_by_default_tracing_category,
const char* disabled_by_default_verbose_tracing_category);
- // Represents a time at which a task wants to run. Tasks scheduled for the
- // same point in time will be ordered by their sequence numbers.
- struct DelayedWakeUp {
- base::TimeTicks time;
- int sequence_num;
-
- bool operator<=(const DelayedWakeUp& other) const {
- if (time == other.time) {
- DCHECK_NE(sequence_num, other.sequence_num);
- return (sequence_num - other.sequence_num) < 0;
- }
- return time < other.time;
- }
- };
-
class BLINK_PLATFORM_EXPORT Task : public base::PendingTask {
public:
Task();
@@ -96,10 +81,6 @@ class BLINK_PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
bool nestable,
EnqueueOrder enqueue_order);
- DelayedWakeUp delayed_wake_up() const {
- return DelayedWakeUp{delayed_run_time, sequence_num};
- }
-
EnqueueOrder enqueue_order() const {
#ifndef NDEBUG
DCHECK(enqueue_order_set_);
@@ -131,6 +112,21 @@ class BLINK_PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
EnqueueOrder enqueue_order_;
};
+ // Represents a time at which a task wants to run. Tasks scheduled for the
+ // same point in time will be ordered by their sequence numbers.
+ struct DelayedWakeUp {
+ base::TimeTicks time;
+ int sequence_num;
+
+ bool operator<=(const DelayedWakeUp& other) const {
+ if (time == other.time) {
+ DCHECK_NE(sequence_num, other.sequence_num);
+ return (sequence_num - other.sequence_num) < 0;
+ }
+ return time < other.time;
+ }
+ };
+
// TaskQueue implementation.
void UnregisterTaskQueue() override;
bool RunsTasksOnCurrentThread() const override;
@@ -159,7 +155,6 @@ class BLINK_PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
bool BlockedByFence() const override;
const char* GetName() const override;
QueueType GetQueueType() const override;
- void SetObserver(Observer* observer) override;
// Returns true if a (potentially hypothetical) task with the specified
// |enqueue_order| could run on the queue. Must be called from the main
@@ -198,18 +193,18 @@ class BLINK_PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
}
// Enqueues any delayed tasks which should be run now on the
- // |delayed_work_queue|. Returns the subsequent wake-up that is required, if
+ // |delayed_work_queue|. Returns the subsequent wakeup that is required, if
// any. Must be called from the main thread.
base::Optional<DelayedWakeUp> WakeUpForDelayedWork(LazyNow* lazy_now);
- base::TimeTicks scheduled_time_domain_wake_up() const {
- return main_thread_only().scheduled_time_domain_wake_up;
+ base::TimeTicks scheduled_time_domain_wakeup() const {
+ return main_thread_only().scheduled_time_domain_wakeup;
}
- 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;
+ void set_scheduled_time_domain_wakeup(
+ base::TimeTicks scheduled_time_domain_wakeup) {
+ main_thread_only().scheduled_time_domain_wakeup =
+ scheduled_time_domain_wakeup;
}
HeapHandle heap_handle() const { return main_thread_only().heap_handle; }
@@ -254,12 +249,11 @@ class BLINK_PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
AnyThread(TaskQueueManager* task_queue_manager, TimeDomain* time_domain);
~AnyThread();
- // TaskQueueManager, TimeDomain and Observer are maintained in two copies:
+ // TaskQueueManager and TimeDomain are maintained in two copies:
// inside AnyThread and inside MainThreadOnly. They can be changed only from
// main thread, so it should be locked before accessing from other threads.
TaskQueueManager* task_queue_manager;
TimeDomain* time_domain;
- Observer* observer;
};
struct MainThreadOnly {
@@ -268,12 +262,10 @@ class BLINK_PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
TimeDomain* time_domain);
~MainThreadOnly();
- // Another copy of TaskQueueManager, TimeDomain and Observer
- // for lock-free access from the main thread.
- // See description inside struct AnyThread for details.
+ // Another copy of TaskQueueManager and TimeDomain for lock-free access from
+ // the main thread. See description inside struct AnyThread for details.
TaskQueueManager* task_queue_manager;
TimeDomain* time_domain;
- Observer* observer;
std::unique_ptr<WorkQueue> delayed_work_queue;
std::unique_ptr<WorkQueue> immediate_work_queue;
@@ -285,7 +277,7 @@ class BLINK_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::TimeTicks scheduled_time_domain_wakeup;
};
~TaskQueueImpl() override;
@@ -337,11 +329,6 @@ class BLINK_PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
void OnQueueEnabledVoteChanged(bool enabled);
void EnableOrDisableWithSelector(bool enable);
- // 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