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

Side by Side Diff: base/task_scheduler/task_scheduler.h

Issue 2726523002: Pass Callback to TaskRunner by value and consume it on invocation (1) (Closed)
Patch Set: s/base::ResetAndReturn/std::move/ Created 3 years, 9 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
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 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 5 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/base_export.h" 12 #include "base/base_export.h"
13 #include "base/callback_forward.h" 13 #include "base/callback.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/task_runner.h" 17 #include "base/task_runner.h"
18 #include "base/task_scheduler/task_traits.h" 18 #include "base/task_scheduler/task_traits.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 20
21 namespace gin { 21 namespace gin {
22 class V8Platform; 22 class V8Platform;
23 } 23 }
(...skipping 22 matching lines...) Expand all
46 // Destroying a TaskScheduler is not allowed in production; it is always 46 // Destroying a TaskScheduler is not allowed in production; it is always
47 // leaked. In tests, it should only be destroyed after JoinForTesting() has 47 // leaked. In tests, it should only be destroyed after JoinForTesting() has
48 // returned. 48 // returned.
49 virtual ~TaskScheduler() = default; 49 virtual ~TaskScheduler() = default;
50 50
51 // Posts |task| with a |delay| and specific |traits|. |delay| can be zero. 51 // Posts |task| with a |delay| and specific |traits|. |delay| can be zero.
52 // For one off tasks that don't require a TaskRunner. 52 // For one off tasks that don't require a TaskRunner.
53 virtual void PostDelayedTaskWithTraits( 53 virtual void PostDelayedTaskWithTraits(
54 const tracked_objects::Location& from_here, 54 const tracked_objects::Location& from_here,
55 const TaskTraits& traits, 55 const TaskTraits& traits,
56 const Closure& task, 56 Closure task,
57 TimeDelta delay) = 0; 57 TimeDelta delay) = 0;
58 58
59 // Returns a TaskRunner whose PostTask invocations result in scheduling tasks 59 // Returns a TaskRunner whose PostTask invocations result in scheduling tasks
60 // using |traits|. Tasks may run in any order and in parallel. 60 // using |traits|. Tasks may run in any order and in parallel.
61 virtual scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( 61 virtual scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(
62 const TaskTraits& traits) = 0; 62 const TaskTraits& traits) = 0;
63 63
64 // Returns a SequencedTaskRunner whose PostTask invocations result in 64 // Returns a SequencedTaskRunner whose PostTask invocations result in
65 // scheduling tasks using |traits|. Tasks run one at a time in posting order. 65 // scheduling tasks using |traits|. Tasks run one at a time in posting order.
66 virtual scoped_refptr<SequencedTaskRunner> 66 virtual scoped_refptr<SequencedTaskRunner>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. 155 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items.
156 // 156 //
157 // TODO(fdoray): Remove this method. https://crbug.com/687264 157 // TODO(fdoray): Remove this method. https://crbug.com/687264
158 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( 158 virtual int GetMaxConcurrentTasksWithTraitsDeprecated(
159 const TaskTraits& traits) const = 0; 159 const TaskTraits& traits) const = 0;
160 }; 160 };
161 161
162 } // namespace base 162 } // namespace base
163 163
164 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 164 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698