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

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

Issue 2785943004: DCHECK tasks posted by TaskRunner::PostTask (Closed)
Patch Set: fix 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
« no previous file with comments | « content/renderer/categorized_worker_pool.cc ('k') | 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 <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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 TaskType::NON_NESTABLE); 212 TaskType::NON_NESTABLE);
213 213
214 return PostDelayedTaskImpl(from_here, std::move(task), delay, 214 return PostDelayedTaskImpl(from_here, std::move(task), delay,
215 TaskType::NON_NESTABLE); 215 TaskType::NON_NESTABLE);
216 } 216 }
217 217
218 bool TaskQueueImpl::PostImmediateTaskImpl( 218 bool TaskQueueImpl::PostImmediateTaskImpl(
219 const tracked_objects::Location& from_here, 219 const tracked_objects::Location& from_here,
220 base::Closure task, 220 base::Closure task,
221 TaskType task_type) { 221 TaskType task_type) {
222 DCHECK(task);
222 base::AutoLock lock(any_thread_lock_); 223 base::AutoLock lock(any_thread_lock_);
223 if (!any_thread().task_queue_manager) 224 if (!any_thread().task_queue_manager)
224 return false; 225 return false;
225 226
226 EnqueueOrder sequence_number = 227 EnqueueOrder sequence_number =
227 any_thread().task_queue_manager->GetNextSequenceNumber(); 228 any_thread().task_queue_manager->GetNextSequenceNumber();
228 229
229 PushOntoImmediateIncomingQueueLocked(from_here, std::move(task), 230 PushOntoImmediateIncomingQueueLocked(from_here, std::move(task),
230 base::TimeTicks(), sequence_number, 231 base::TimeTicks(), sequence_number,
231 task_type != TaskType::NON_NESTABLE); 232 task_type != TaskType::NON_NESTABLE);
232 return true; 233 return true;
233 } 234 }
234 235
235 bool TaskQueueImpl::PostDelayedTaskImpl( 236 bool TaskQueueImpl::PostDelayedTaskImpl(
236 const tracked_objects::Location& from_here, 237 const tracked_objects::Location& from_here,
237 base::Closure task, 238 base::Closure task,
238 base::TimeDelta delay, 239 base::TimeDelta delay,
239 TaskType task_type) { 240 TaskType task_type) {
241 DCHECK(task);
240 DCHECK_GT(delay, base::TimeDelta()); 242 DCHECK_GT(delay, base::TimeDelta());
241 if (base::PlatformThread::CurrentId() == thread_id_) { 243 if (base::PlatformThread::CurrentId() == thread_id_) {
242 // Lock-free fast path for delayed tasks posted from the main thread. 244 // Lock-free fast path for delayed tasks posted from the main thread.
243 if (!main_thread_only().task_queue_manager) 245 if (!main_thread_only().task_queue_manager)
244 return false; 246 return false;
245 247
246 EnqueueOrder sequence_number = 248 EnqueueOrder sequence_number =
247 main_thread_only().task_queue_manager->GetNextSequenceNumber(); 249 main_thread_only().task_queue_manager->GetNextSequenceNumber();
248 250
249 base::TimeTicks time_domain_now = main_thread_only().time_domain->Now(); 251 base::TimeTicks time_domain_now = main_thread_only().time_domain->Now();
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 887
886 void TaskQueueImpl::PushImmediateIncomingTaskForTest( 888 void TaskQueueImpl::PushImmediateIncomingTaskForTest(
887 TaskQueueImpl::Task&& task) { 889 TaskQueueImpl::Task&& task) {
888 base::AutoLock lock(immediate_incoming_queue_lock_); 890 base::AutoLock lock(immediate_incoming_queue_lock_);
889 immediate_incoming_queue().push_back(std::move(task)); 891 immediate_incoming_queue().push_back(std::move(task));
890 } 892 }
891 893
892 } // namespace internal 894 } // namespace internal
893 } // namespace scheduler 895 } // namespace scheduler
894 } // namespace blink 896 } // namespace blink
OLDNEW
« no previous file with comments | « content/renderer/categorized_worker_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698