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

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

Issue 2637843002: Migrate base::TaskRunner from Closure to OnceClosure (Closed)
Patch Set: rebase 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 unified diff | Download patch
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_IMPL_H_ 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 TaskQueueImpl(TaskQueueManager* task_queue_manager, 62 TaskQueueImpl(TaskQueueManager* task_queue_manager,
63 TimeDomain* time_domain, 63 TimeDomain* time_domain,
64 const Spec& spec, 64 const Spec& spec,
65 const char* disabled_by_default_tracing_category, 65 const char* disabled_by_default_tracing_category,
66 const char* disabled_by_default_verbose_tracing_category); 66 const char* disabled_by_default_verbose_tracing_category);
67 67
68 class BLINK_PLATFORM_EXPORT Task : public base::PendingTask { 68 class BLINK_PLATFORM_EXPORT Task : public base::PendingTask {
69 public: 69 public:
70 Task(); 70 Task();
71 Task(const tracked_objects::Location& posted_from, 71 Task(const tracked_objects::Location& posted_from,
72 base::Closure task, 72 base::OnceClosure task,
73 base::TimeTicks desired_run_time, 73 base::TimeTicks desired_run_time,
74 EnqueueOrder sequence_number, 74 EnqueueOrder sequence_number,
75 bool nestable); 75 bool nestable);
76 76
77 Task(const tracked_objects::Location& posted_from, 77 Task(const tracked_objects::Location& posted_from,
78 base::Closure task, 78 base::OnceClosure task,
79 base::TimeTicks desired_run_time, 79 base::TimeTicks desired_run_time,
80 EnqueueOrder sequence_number, 80 EnqueueOrder sequence_number,
81 bool nestable, 81 bool nestable,
82 EnqueueOrder enqueue_order); 82 EnqueueOrder enqueue_order);
83 83
84 EnqueueOrder enqueue_order() const { 84 EnqueueOrder enqueue_order() const {
85 #ifndef NDEBUG 85 #ifndef NDEBUG
86 DCHECK(enqueue_order_set_); 86 DCHECK(enqueue_order_set_);
87 #endif 87 #endif
88 return enqueue_order_; 88 return enqueue_order_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return (sequence_num - other.sequence_num) < 0; 124 return (sequence_num - other.sequence_num) < 0;
125 } 125 }
126 return time < other.time; 126 return time < other.time;
127 } 127 }
128 }; 128 };
129 129
130 // TaskQueue implementation. 130 // TaskQueue implementation.
131 void UnregisterTaskQueue() override; 131 void UnregisterTaskQueue() override;
132 bool RunsTasksOnCurrentThread() const override; 132 bool RunsTasksOnCurrentThread() const override;
133 bool PostDelayedTask(const tracked_objects::Location& from_here, 133 bool PostDelayedTask(const tracked_objects::Location& from_here,
134 base::Closure task, 134 base::OnceClosure task,
135 base::TimeDelta delay) override; 135 base::TimeDelta delay) override;
136 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, 136 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
137 base::Closure task, 137 base::OnceClosure task,
138 base::TimeDelta delay) override; 138 base::TimeDelta delay) override;
139 std::unique_ptr<QueueEnabledVoter> CreateQueueEnabledVoter() override; 139 std::unique_ptr<QueueEnabledVoter> CreateQueueEnabledVoter() override;
140 bool IsQueueEnabled() const override; 140 bool IsQueueEnabled() const override;
141 bool IsEmpty() const override; 141 bool IsEmpty() const override;
142 size_t GetNumberOfPendingTasks() const override; 142 size_t GetNumberOfPendingTasks() const override;
143 bool HasPendingImmediateWork() const override; 143 bool HasPendingImmediateWork() const override;
144 base::Optional<base::TimeTicks> GetNextScheduledWakeUp() override; 144 base::Optional<base::TimeTicks> GetNextScheduledWakeUp() override;
145 void SetQueuePriority(QueuePriority priority) override; 145 void SetQueuePriority(QueuePriority priority) override;
146 QueuePriority GetQueuePriority() const override; 146 QueuePriority GetQueuePriority() const override;
147 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override; 147 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 int is_enabled_refcount; 276 int is_enabled_refcount;
277 int voter_refcount; 277 int voter_refcount;
278 base::trace_event::BlameContext* blame_context; // Not owned. 278 base::trace_event::BlameContext* blame_context; // Not owned.
279 EnqueueOrder current_fence; 279 EnqueueOrder current_fence;
280 base::TimeTicks scheduled_time_domain_wakeup; 280 base::TimeTicks scheduled_time_domain_wakeup;
281 }; 281 };
282 282
283 ~TaskQueueImpl() override; 283 ~TaskQueueImpl() override;
284 284
285 bool PostImmediateTaskImpl(const tracked_objects::Location& from_here, 285 bool PostImmediateTaskImpl(const tracked_objects::Location& from_here,
286 base::Closure task, 286 base::OnceClosure task,
287 TaskType task_type); 287 TaskType task_type);
288 bool PostDelayedTaskImpl(const tracked_objects::Location& from_here, 288 bool PostDelayedTaskImpl(const tracked_objects::Location& from_here,
289 base::Closure task, 289 base::OnceClosure task,
290 base::TimeDelta delay, 290 base::TimeDelta delay,
291 TaskType task_type); 291 TaskType task_type);
292 292
293 // Push the task onto the |delayed_incoming_queue|. Lock-free main thread 293 // Push the task onto the |delayed_incoming_queue|. Lock-free main thread
294 // only fast path. 294 // only fast path.
295 void PushOntoDelayedIncomingQueueFromMainThread(Task pending_task, 295 void PushOntoDelayedIncomingQueueFromMainThread(Task pending_task,
296 base::TimeTicks now); 296 base::TimeTicks now);
297 297
298 // Push the task onto the |delayed_incoming_queue|. Slow path from other 298 // Push the task onto the |delayed_incoming_queue|. Slow path from other
299 // threads. 299 // threads.
300 void PushOntoDelayedIncomingQueueLocked(Task pending_task); 300 void PushOntoDelayedIncomingQueueLocked(Task pending_task);
301 301
302 void ScheduleDelayedWorkTask(Task pending_task); 302 void ScheduleDelayedWorkTask(Task pending_task);
303 303
304 void MoveReadyImmediateTasksToImmediateWorkQueueLocked(); 304 void MoveReadyImmediateTasksToImmediateWorkQueueLocked();
305 305
306 // Push the task onto the |immediate_incoming_queue| and for auto pumped 306 // Push the task onto the |immediate_incoming_queue| and for auto pumped
307 // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was 307 // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was
308 // empty. 308 // empty.
309 void PushOntoImmediateIncomingQueueLocked( 309 void PushOntoImmediateIncomingQueueLocked(
310 const tracked_objects::Location& posted_from, 310 const tracked_objects::Location& posted_from,
311 base::Closure task, 311 base::OnceClosure task,
312 base::TimeTicks desired_run_time, 312 base::TimeTicks desired_run_time,
313 EnqueueOrder sequence_number, 313 EnqueueOrder sequence_number,
314 bool nestable); 314 bool nestable);
315 315
316 // Extracts all the tasks from the immediate incoming queue and clears it. 316 // Extracts all the tasks from the immediate incoming queue and clears it.
317 // Can be called from any thread. 317 // Can be called from any thread.
318 WTF::Deque<TaskQueueImpl::Task> TakeImmediateIncomingQueue(); 318 WTF::Deque<TaskQueueImpl::Task> TakeImmediateIncomingQueue();
319 319
320 void TraceQueueSize() const; 320 void TraceQueueSize() const;
321 static void QueueAsValueInto(const WTF::Deque<Task>& queue, 321 static void QueueAsValueInto(const WTF::Deque<Task>& queue,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 const bool should_report_when_execution_blocked_; 374 const bool should_report_when_execution_blocked_;
375 375
376 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); 376 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl);
377 }; 377 };
378 378
379 } // namespace internal 379 } // namespace internal
380 } // namespace scheduler 380 } // namespace scheduler
381 } // namespace blink 381 } // namespace blink
382 382
383 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ 383 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698