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