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

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

Issue 2860813004: Change TaskQueueImpl to use a Deque with an inline capacity of 8 (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc » ('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_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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // Push the task onto the |immediate_incoming_queue| and for auto pumped 313 // Push the task onto the |immediate_incoming_queue| and for auto pumped
314 // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was 314 // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was
315 // empty. 315 // empty.
316 void PushOntoImmediateIncomingQueueLocked( 316 void PushOntoImmediateIncomingQueueLocked(
317 const tracked_objects::Location& posted_from, 317 const tracked_objects::Location& posted_from,
318 base::OnceClosure task, 318 base::OnceClosure task,
319 base::TimeTicks desired_run_time, 319 base::TimeTicks desired_run_time,
320 EnqueueOrder sequence_number, 320 EnqueueOrder sequence_number,
321 bool nestable); 321 bool nestable);
322 322
323 // We reserve an inline capacity of 8 tasks to try and reduce the load on
324 // PartitionAlloc.
325 using TaskDeque = WTF::Deque<Task, 8>;
326
323 // Extracts all the tasks from the immediate incoming queue and clears it. 327 // Extracts all the tasks from the immediate incoming queue and clears it.
324 // Can be called from any thread. 328 // Can be called from any thread.
325 WTF::Deque<TaskQueueImpl::Task> TakeImmediateIncomingQueue(); 329 TaskDeque TakeImmediateIncomingQueue();
326 330
327 void TraceQueueSize() const; 331 void TraceQueueSize() const;
328 static void QueueAsValueInto(const WTF::Deque<Task>& queue, 332 static void QueueAsValueInto(const TaskDeque& queue,
329 base::TimeTicks now, 333 base::TimeTicks now,
330 base::trace_event::TracedValue* state); 334 base::trace_event::TracedValue* state);
331 static void QueueAsValueInto(const std::priority_queue<Task>& queue, 335 static void QueueAsValueInto(const std::priority_queue<Task>& queue,
332 base::TimeTicks now, 336 base::TimeTicks now,
333 base::trace_event::TracedValue* state); 337 base::trace_event::TracedValue* state);
334 static void TaskAsValueInto(const Task& task, 338 static void TaskAsValueInto(const Task& task,
335 base::TimeTicks now, 339 base::TimeTicks now,
336 base::trace_event::TracedValue* state); 340 base::trace_event::TracedValue* state);
337 341
338 void RemoveQueueEnabledVoter(const QueueEnabledVoterImpl* voter); 342 void RemoveQueueEnabledVoter(const QueueEnabledVoterImpl* voter);
(...skipping 26 matching lines...) Expand all
365 MainThreadOnly& main_thread_only() { 369 MainThreadOnly& main_thread_only() {
366 DCHECK(main_thread_checker_.CalledOnValidThread()); 370 DCHECK(main_thread_checker_.CalledOnValidThread());
367 return main_thread_only_; 371 return main_thread_only_;
368 } 372 }
369 const MainThreadOnly& main_thread_only() const { 373 const MainThreadOnly& main_thread_only() const {
370 DCHECK(main_thread_checker_.CalledOnValidThread()); 374 DCHECK(main_thread_checker_.CalledOnValidThread());
371 return main_thread_only_; 375 return main_thread_only_;
372 } 376 }
373 377
374 mutable base::Lock immediate_incoming_queue_lock_; 378 mutable base::Lock immediate_incoming_queue_lock_;
375 WTF::Deque<Task> immediate_incoming_queue_; 379 TaskDeque immediate_incoming_queue_;
376 WTF::Deque<Task>& immediate_incoming_queue() { 380 TaskDeque& immediate_incoming_queue() {
377 immediate_incoming_queue_lock_.AssertAcquired(); 381 immediate_incoming_queue_lock_.AssertAcquired();
378 return immediate_incoming_queue_; 382 return immediate_incoming_queue_;
379 } 383 }
380 const WTF::Deque<Task>& immediate_incoming_queue() const { 384 const TaskDeque& immediate_incoming_queue() const {
381 immediate_incoming_queue_lock_.AssertAcquired(); 385 immediate_incoming_queue_lock_.AssertAcquired();
382 return immediate_incoming_queue_; 386 return immediate_incoming_queue_;
383 } 387 }
384 388
385 const bool should_monitor_quiescence_; 389 const bool should_monitor_quiescence_;
386 const bool should_notify_observers_; 390 const bool should_notify_observers_;
387 const bool should_report_when_execution_blocked_; 391 const bool should_report_when_execution_blocked_;
388 392
389 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); 393 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl);
390 }; 394 };
391 395
392 } // namespace internal 396 } // namespace internal
393 } // namespace scheduler 397 } // namespace scheduler
394 } // namespace blink 398 } // namespace blink
395 399
396 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ 400 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698