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

Side by Side Diff: base/threading/worker_pool_win.cc

Issue 2815573002: CHECK tasks posted by TaskRunner::PostTask (Closed)
Patch Set: +comment 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 | « base/threading/worker_pool_posix.cc ('k') | chrome/browser/after_startup_task_utils.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/threading/worker_pool.h" 5 #include "base/threading/worker_pool.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 27 matching lines...) Expand all
38 38
39 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking( 39 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking(
40 pending_task->birth_tally, pending_task->time_posted, stopwatch); 40 pending_task->birth_tally, pending_task->time_posted, stopwatch);
41 41
42 delete pending_task; 42 delete pending_task;
43 return 0; 43 return 0;
44 } 44 }
45 45
46 // Takes ownership of |pending_task| 46 // Takes ownership of |pending_task|
47 bool PostTaskInternal(PendingTask* pending_task, bool task_is_slow) { 47 bool PostTaskInternal(PendingTask* pending_task, bool task_is_slow) {
48 DCHECK(pending_task->task); 48 // Use CHECK instead of DCHECK to crash earlier. See http://crbug.com/711167
49 // for details.
50 CHECK(pending_task->task);
49 51
50 ULONG flags = 0; 52 ULONG flags = 0;
51 if (task_is_slow) 53 if (task_is_slow)
52 flags |= WT_EXECUTELONGFUNCTION; 54 flags |= WT_EXECUTELONGFUNCTION;
53 55
54 if (!QueueUserWorkItem(WorkItemCallback, pending_task, flags)) { 56 if (!QueueUserWorkItem(WorkItemCallback, pending_task, flags)) {
55 DPLOG(ERROR) << "QueueUserWorkItem failed"; 57 DPLOG(ERROR) << "QueueUserWorkItem failed";
56 delete pending_task; 58 delete pending_task;
57 return false; 59 return false;
58 } 60 }
(...skipping 10 matching lines...) Expand all
69 PendingTask* pending_task = new PendingTask(from_here, std::move(task)); 71 PendingTask* pending_task = new PendingTask(from_here, std::move(task));
70 return PostTaskInternal(pending_task, task_is_slow); 72 return PostTaskInternal(pending_task, task_is_slow);
71 } 73 }
72 74
73 // static 75 // static
74 bool WorkerPool::RunsTasksOnCurrentThread() { 76 bool WorkerPool::RunsTasksOnCurrentThread() {
75 return GetWorkerPoolRunningOnThisThread()->Get(); 77 return GetWorkerPoolRunningOnThisThread()->Get();
76 } 78 }
77 79
78 } // namespace base 80 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/worker_pool_posix.cc ('k') | chrome/browser/after_startup_task_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698