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

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 without dcheck_in_ref_count 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 int is_enabled_refcount; 278 int is_enabled_refcount;
279 int voter_refcount; 279 int voter_refcount;
280 base::trace_event::BlameContext* blame_context; // Not owned. 280 base::trace_event::BlameContext* blame_context; // Not owned.
281 EnqueueOrder current_fence; 281 EnqueueOrder current_fence;
282 base::TimeTicks scheduled_time_domain_wakeup; 282 base::TimeTicks scheduled_time_domain_wakeup;
283 }; 283 };
284 284
285 ~TaskQueueImpl() override; 285 ~TaskQueueImpl() override;
286 286
287 bool PostImmediateTaskImpl(const tracked_objects::Location& from_here, 287 bool PostImmediateTaskImpl(const tracked_objects::Location& from_here,
288 base::Closure task, 288 base::OnceClosure task,
289 TaskType task_type); 289 TaskType task_type);
290 bool PostDelayedTaskImpl(const tracked_objects::Location& from_here, 290 bool PostDelayedTaskImpl(const tracked_objects::Location& from_here,
291 base::Closure task, 291 base::OnceClosure task,
292 base::TimeDelta delay, 292 base::TimeDelta delay,
293 TaskType task_type); 293 TaskType task_type);
294 294
295 // Push the task onto the |delayed_incoming_queue|. Lock-free main thread 295 // Push the task onto the |delayed_incoming_queue|. Lock-free main thread
296 // only fast path. 296 // only fast path.
297 void PushOntoDelayedIncomingQueueFromMainThread(Task pending_task, 297 void PushOntoDelayedIncomingQueueFromMainThread(Task pending_task,
298 base::TimeTicks now); 298 base::TimeTicks now);
299 299
300 // Push the task onto the |delayed_incoming_queue|. Slow path from other 300 // Push the task onto the |delayed_incoming_queue|. Slow path from other
301 // threads. 301 // threads.
302 void PushOntoDelayedIncomingQueueLocked(Task pending_task); 302 void PushOntoDelayedIncomingQueueLocked(Task pending_task);
303 303
304 void ScheduleDelayedWorkTask(Task pending_task); 304 void ScheduleDelayedWorkTask(Task pending_task);
305 305
306 void MoveReadyImmediateTasksToImmediateWorkQueueLocked(); 306 void MoveReadyImmediateTasksToImmediateWorkQueueLocked();
307 307
308 // Push the task onto the |immediate_incoming_queue| and for auto pumped 308 // Push the task onto the |immediate_incoming_queue| and for auto pumped
309 // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was 309 // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was
310 // empty. 310 // empty.
311 void PushOntoImmediateIncomingQueueLocked( 311 void PushOntoImmediateIncomingQueueLocked(
312 const tracked_objects::Location& posted_from, 312 const tracked_objects::Location& posted_from,
313 base::Closure task, 313 base::OnceClosure task,
314 base::TimeTicks desired_run_time, 314 base::TimeTicks desired_run_time,
315 EnqueueOrder sequence_number, 315 EnqueueOrder sequence_number,
316 bool nestable); 316 bool nestable);
317 317
318 // Extracts all the tasks from the immediate incoming queue and clears it. 318 // Extracts all the tasks from the immediate incoming queue and clears it.
319 // Can be called from any thread. 319 // Can be called from any thread.
320 WTF::Deque<TaskQueueImpl::Task> TakeImmediateIncomingQueue(); 320 WTF::Deque<TaskQueueImpl::Task> TakeImmediateIncomingQueue();
321 321
322 void TraceQueueSize(bool is_locked) const; 322 void TraceQueueSize(bool is_locked) const;
323 static void QueueAsValueInto(const WTF::Deque<Task>& queue, 323 static void QueueAsValueInto(const WTF::Deque<Task>& queue,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 const bool should_report_when_execution_blocked_; 365 const bool should_report_when_execution_blocked_;
366 366
367 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); 367 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl);
368 }; 368 };
369 369
370 } // namespace internal 370 } // namespace internal
371 } // namespace scheduler 371 } // namespace scheduler
372 } // namespace blink 372 } // namespace blink
373 373
374 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ 374 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698