| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |