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

Side by Side Diff: base/task_scheduler/task_tracker.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 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/task_scheduler/task_tracker.h ('k') | base/task_scheduler/task_tracker_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/task_scheduler/task_tracker.h" 5 #include "base/task_scheduler/task_tracker.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/debug/task_annotator.h" 8 #include "base/debug/task_annotator.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // posted during shutdown. Otherwise, the histogram has already been recorded 52 // posted during shutdown. Otherwise, the histogram has already been recorded
53 // in BeforePostTask(). 53 // in BeforePostTask().
54 if (num_block_shutdown_tasks_posted_during_shutdown_ < 54 if (num_block_shutdown_tasks_posted_during_shutdown_ <
55 kMaxBlockShutdownTasksPostedDuringShutdown) { 55 kMaxBlockShutdownTasksPostedDuringShutdown) {
56 RecordNumBlockShutdownTasksPostedDuringShutdown( 56 RecordNumBlockShutdownTasksPostedDuringShutdown(
57 num_block_shutdown_tasks_posted_during_shutdown_); 57 num_block_shutdown_tasks_posted_during_shutdown_);
58 } 58 }
59 } 59 }
60 60
61 void TaskTracker::PostTask( 61 void TaskTracker::PostTask(
62 const Callback<void(scoped_ptr<Task>)>& post_task_callback, 62 const Callback<void(std::unique_ptr<Task>)>& post_task_callback,
63 scoped_ptr<Task> task) { 63 std::unique_ptr<Task> task) {
64 DCHECK(!post_task_callback.is_null()); 64 DCHECK(!post_task_callback.is_null());
65 DCHECK(task); 65 DCHECK(task);
66 66
67 if (!BeforePostTask(task->traits.shutdown_behavior())) 67 if (!BeforePostTask(task->traits.shutdown_behavior()))
68 return; 68 return;
69 69
70 debug::TaskAnnotator task_annotator; 70 debug::TaskAnnotator task_annotator;
71 task_annotator.DidQueueTask(kQueueFunctionName, *task); 71 task_annotator.DidQueueTask(kQueueFunctionName, *task);
72 72
73 post_task_callback.Run(std::move(task)); 73 post_task_callback.Run(std::move(task));
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 AutoSchedulerLock auto_lock(lock_); 174 AutoSchedulerLock auto_lock(lock_);
175 DCHECK_GT(num_tasks_blocking_shutdown_, 0U); 175 DCHECK_GT(num_tasks_blocking_shutdown_, 0U);
176 --num_tasks_blocking_shutdown_; 176 --num_tasks_blocking_shutdown_;
177 if (num_tasks_blocking_shutdown_ == 0 && shutdown_cv_) 177 if (num_tasks_blocking_shutdown_ == 0 && shutdown_cv_)
178 shutdown_cv_->Signal(); 178 shutdown_cv_->Signal();
179 } 179 }
180 } 180 }
181 181
182 } // namespace internal 182 } // namespace internal
183 } // namespace base 183 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/task_tracker.h ('k') | base/task_scheduler/task_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698