OLD | NEW |
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> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // Destroying a TaskScheduler is not allowed in production; it is always | 63 // Destroying a TaskScheduler is not allowed in production; it is always |
64 // leaked. In tests, it should only be destroyed after JoinForTesting() has | 64 // leaked. In tests, it should only be destroyed after JoinForTesting() has |
65 // returned. | 65 // returned. |
66 virtual ~TaskScheduler() = default; | 66 virtual ~TaskScheduler() = default; |
67 | 67 |
68 // Posts |task| with a |delay| and specific |traits|. |delay| can be zero. | 68 // Posts |task| with a |delay| and specific |traits|. |delay| can be zero. |
69 // For one off tasks that don't require a TaskRunner. | 69 // For one off tasks that don't require a TaskRunner. |
70 virtual void PostDelayedTaskWithTraits( | 70 virtual void PostDelayedTaskWithTraits( |
71 const tracked_objects::Location& from_here, | 71 const tracked_objects::Location& from_here, |
72 const TaskTraits& traits, | 72 const TaskTraits& traits, |
73 Closure task, | 73 OnceClosure task, |
74 TimeDelta delay) = 0; | 74 TimeDelta delay) = 0; |
75 | 75 |
76 // Returns a TaskRunner whose PostTask invocations result in scheduling tasks | 76 // Returns a TaskRunner whose PostTask invocations result in scheduling tasks |
77 // using |traits|. Tasks may run in any order and in parallel. | 77 // using |traits|. Tasks may run in any order and in parallel. |
78 virtual scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( | 78 virtual scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( |
79 const TaskTraits& traits) = 0; | 79 const TaskTraits& traits) = 0; |
80 | 80 |
81 // Returns a SequencedTaskRunner whose PostTask invocations result in | 81 // Returns a SequencedTaskRunner whose PostTask invocations result in |
82 // scheduling tasks using |traits|. Tasks run one at a time in posting order. | 82 // scheduling tasks using |traits|. Tasks run one at a time in posting order. |
83 virtual scoped_refptr<SequencedTaskRunner> | 83 virtual scoped_refptr<SequencedTaskRunner> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. | 198 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. |
199 // | 199 // |
200 // TODO(fdoray): Remove this method. https://crbug.com/687264 | 200 // TODO(fdoray): Remove this method. https://crbug.com/687264 |
201 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( | 201 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( |
202 const TaskTraits& traits) const = 0; | 202 const TaskTraits& traits) const = 0; |
203 }; | 203 }; |
204 | 204 |
205 } // namespace base | 205 } // namespace base |
206 | 206 |
207 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ | 207 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ |
OLD | NEW |