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

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

Issue 2726523002: Pass Callback to TaskRunner by value and consume it on invocation (1) (Closed)
Patch Set: erase Closure* 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/task_scheduler/task_scheduler_impl.h ('k') | base/test/null_task_runner.h » ('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_scheduler_impl.h" 5 #include "base/task_scheduler/task_scheduler_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 26 matching lines...) Expand all
37 37
38 TaskSchedulerImpl::~TaskSchedulerImpl() { 38 TaskSchedulerImpl::~TaskSchedulerImpl() {
39 #if DCHECK_IS_ON() 39 #if DCHECK_IS_ON()
40 DCHECK(join_for_testing_returned_.IsSet()); 40 DCHECK(join_for_testing_returned_.IsSet());
41 #endif 41 #endif
42 } 42 }
43 43
44 void TaskSchedulerImpl::PostDelayedTaskWithTraits( 44 void TaskSchedulerImpl::PostDelayedTaskWithTraits(
45 const tracked_objects::Location& from_here, 45 const tracked_objects::Location& from_here,
46 const TaskTraits& traits, 46 const TaskTraits& traits,
47 const Closure& task, 47 Closure task,
48 TimeDelta delay) { 48 TimeDelta delay) {
49 // Post |task| as part of a one-off single-task Sequence. 49 // Post |task| as part of a one-off single-task Sequence.
50 GetWorkerPoolForTraits(traits)->PostTaskWithSequence( 50 GetWorkerPoolForTraits(traits)->PostTaskWithSequence(
51 MakeUnique<Task>(from_here, task, traits, delay), 51 MakeUnique<Task>(from_here, std::move(task), traits, delay),
52 make_scoped_refptr(new Sequence)); 52 make_scoped_refptr(new Sequence));
53 } 53 }
54 54
55 scoped_refptr<TaskRunner> TaskSchedulerImpl::CreateTaskRunnerWithTraits( 55 scoped_refptr<TaskRunner> TaskSchedulerImpl::CreateTaskRunnerWithTraits(
56 const TaskTraits& traits) { 56 const TaskTraits& traits) {
57 return GetWorkerPoolForTraits(traits)->CreateTaskRunnerWithTraits(traits); 57 return GetWorkerPoolForTraits(traits)->CreateTaskRunnerWithTraits(traits);
58 } 58 }
59 59
60 scoped_refptr<SequencedTaskRunner> 60 scoped_refptr<SequencedTaskRunner>
61 TaskSchedulerImpl::CreateSequencedTaskRunnerWithTraits( 61 TaskSchedulerImpl::CreateSequencedTaskRunnerWithTraits(
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // in |sequence|. 191 // in |sequence|.
192 const TaskTraits traits = 192 const TaskTraits traits =
193 sequence->PeekTaskTraits().WithPriority(sort_key.priority()); 193 sequence->PeekTaskTraits().WithPriority(sort_key.priority());
194 194
195 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence), 195 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence),
196 sort_key); 196 sort_key);
197 } 197 }
198 198
199 } // namespace internal 199 } // namespace internal
200 } // namespace base 200 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/task_scheduler_impl.h ('k') | base/test/null_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698