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

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

Issue 2644723003: Remove lock from TaskQueueImpl::RunsTasksOnCurrentThread (Closed)
Patch Set: Created 3 years, 11 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 | no next file » | 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 #include "platform/scheduler/base/task_queue_impl.h" 5 #include "platform/scheduler/base/task_queue_impl.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/blame_context.h" 10 #include "base/trace_event/blame_context.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 any_thread().task_queue_manager = nullptr; 177 any_thread().task_queue_manager = nullptr;
178 main_thread_only().task_queue_manager = nullptr; 178 main_thread_only().task_queue_manager = nullptr;
179 main_thread_only().delayed_incoming_queue = std::priority_queue<Task>(); 179 main_thread_only().delayed_incoming_queue = std::priority_queue<Task>();
180 any_thread().immediate_incoming_queue.clear(); 180 any_thread().immediate_incoming_queue.clear();
181 main_thread_only().immediate_work_queue.reset(); 181 main_thread_only().immediate_work_queue.reset();
182 main_thread_only().delayed_work_queue.reset(); 182 main_thread_only().delayed_work_queue.reset();
183 } 183 }
184 184
185 bool TaskQueueImpl::RunsTasksOnCurrentThread() const { 185 bool TaskQueueImpl::RunsTasksOnCurrentThread() const {
186 base::AutoLock lock(any_thread_lock_);
187 return base::PlatformThread::CurrentId() == thread_id_; 186 return base::PlatformThread::CurrentId() == thread_id_;
188 } 187 }
189 188
190 bool TaskQueueImpl::PostDelayedTask(const tracked_objects::Location& from_here, 189 bool TaskQueueImpl::PostDelayedTask(const tracked_objects::Location& from_here,
191 const base::Closure& task, 190 const base::Closure& task,
192 base::TimeDelta delay) { 191 base::TimeDelta delay) {
193 if (delay.is_zero()) 192 if (delay.is_zero())
194 return PostImmediateTaskImpl(from_here, task, TaskType::NORMAL); 193 return PostImmediateTaskImpl(from_here, task, TaskType::NORMAL);
195 194
196 return PostDelayedTaskImpl(from_here, task, delay, TaskType::NORMAL); 195 return PostDelayedTaskImpl(from_here, task, delay, TaskType::NORMAL);
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 const_cast<Task&>(main_thread_only().delayed_incoming_queue.top()))); 831 const_cast<Task&>(main_thread_only().delayed_incoming_queue.top())));
833 } 832 }
834 main_thread_only().delayed_incoming_queue.pop(); 833 main_thread_only().delayed_incoming_queue.pop();
835 } 834 }
836 main_thread_only().delayed_incoming_queue = std::move(remaining_tasks); 835 main_thread_only().delayed_incoming_queue = std::move(remaining_tasks);
837 } 836 }
838 837
839 } // namespace internal 838 } // namespace internal
840 } // namespace scheduler 839 } // namespace scheduler
841 } // namespace blink 840 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698