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

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

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
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 #include "platform/scheduler/base/task_queue_impl.h" 5 #include "platform/scheduler/base/task_queue_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 TraceQueueSize(); 366 TraceQueueSize();
367 } 367 }
368 368
369 void TaskQueueImpl::ReloadImmediateWorkQueueIfEmpty() { 369 void TaskQueueImpl::ReloadImmediateWorkQueueIfEmpty() {
370 if (!main_thread_only().immediate_work_queue->Empty()) 370 if (!main_thread_only().immediate_work_queue->Empty())
371 return; 371 return;
372 372
373 main_thread_only().immediate_work_queue->ReloadEmptyImmediateQueue(); 373 main_thread_only().immediate_work_queue->ReloadEmptyImmediateQueue();
374 } 374 }
375 375
376 WTF::Deque<TaskQueueImpl::Task> TaskQueueImpl::TakeImmediateIncomingQueue() { 376 TaskQueueImpl::TaskDeque TaskQueueImpl::TakeImmediateIncomingQueue() {
377 base::AutoLock immediate_incoming_queue_lock(immediate_incoming_queue_lock_); 377 base::AutoLock immediate_incoming_queue_lock(immediate_incoming_queue_lock_);
378 WTF::Deque<TaskQueueImpl::Task> queue; 378 TaskQueueImpl::TaskDeque queue;
379 queue.Swap(immediate_incoming_queue()); 379 queue.Swap(immediate_incoming_queue());
380 return queue; 380 return queue;
381 } 381 }
382 382
383 bool TaskQueueImpl::IsEmpty() const { 383 bool TaskQueueImpl::IsEmpty() const {
384 if (!main_thread_only().delayed_work_queue->Empty() || 384 if (!main_thread_only().delayed_work_queue->Empty() ||
385 !main_thread_only().delayed_incoming_queue.empty() || 385 !main_thread_only().delayed_incoming_queue.empty() ||
386 !main_thread_only().immediate_work_queue->Empty()) { 386 !main_thread_only().immediate_work_queue->Empty()) {
387 return false; 387 return false;
388 } 388 }
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 return true; 699 return true;
700 700
701 return enqueue_order < main_thread_only().current_fence; 701 return enqueue_order < main_thread_only().current_fence;
702 } 702 }
703 703
704 EnqueueOrder TaskQueueImpl::GetFenceForTest() const { 704 EnqueueOrder TaskQueueImpl::GetFenceForTest() const {
705 return main_thread_only().current_fence; 705 return main_thread_only().current_fence;
706 } 706 }
707 707
708 // static 708 // static
709 void TaskQueueImpl::QueueAsValueInto(const WTF::Deque<Task>& queue, 709 void TaskQueueImpl::QueueAsValueInto(const TaskDeque& queue,
710 base::TimeTicks now, 710 base::TimeTicks now,
711 base::trace_event::TracedValue* state) { 711 base::trace_event::TracedValue* state) {
712 for (const Task& task : queue) { 712 for (const Task& task : queue) {
713 TaskAsValueInto(task, now, state); 713 TaskAsValueInto(task, now, state);
714 } 714 }
715 } 715 }
716 716
717 // static 717 // static
718 void TaskQueueImpl::QueueAsValueInto(const std::priority_queue<Task>& queue, 718 void TaskQueueImpl::QueueAsValueInto(const std::priority_queue<Task>& queue,
719 base::TimeTicks now, 719 base::TimeTicks now,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 } 901 }
902 902
903 void TaskQueueImpl::NotifyWakeUpChangedOnMainThread(base::TimeTicks wake_up) { 903 void TaskQueueImpl::NotifyWakeUpChangedOnMainThread(base::TimeTicks wake_up) {
904 if (main_thread_only().observer) 904 if (main_thread_only().observer)
905 main_thread_only().observer->OnQueueNextWakeUpChanged(this, wake_up); 905 main_thread_only().observer->OnQueueNextWakeUpChanged(this, wake_up);
906 } 906 }
907 907
908 } // namespace internal 908 } // namespace internal
909 } // namespace scheduler 909 } // namespace scheduler
910 } // namespace blink 910 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698