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 <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/task_runner.h" | 16 #include "base/task_runner.h" |
17 #include "base/task_scheduler/task_traits.h" | 17 #include "base/task_scheduler/task_traits.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 | 19 |
20 namespace gin { | 20 namespace gin { |
21 class V8Platform; | 21 class V8Platform; |
22 } | 22 } |
(...skipping 22 matching lines...) Expand all Loading... |
45 // Destroying a TaskScheduler is not allowed in production; it is always | 45 // Destroying a TaskScheduler is not allowed in production; it is always |
46 // leaked. In tests, it should only be destroyed after JoinForTesting() has | 46 // leaked. In tests, it should only be destroyed after JoinForTesting() has |
47 // returned. | 47 // returned. |
48 virtual ~TaskScheduler() = default; | 48 virtual ~TaskScheduler() = default; |
49 | 49 |
50 // Posts |task| with a |delay| and specific |traits|. |delay| can be zero. | 50 // Posts |task| with a |delay| and specific |traits|. |delay| can be zero. |
51 // For one off tasks that don't require a TaskRunner. | 51 // For one off tasks that don't require a TaskRunner. |
52 virtual void PostDelayedTaskWithTraits( | 52 virtual void PostDelayedTaskWithTraits( |
53 const tracked_objects::Location& from_here, | 53 const tracked_objects::Location& from_here, |
54 const TaskTraits& traits, | 54 const TaskTraits& traits, |
55 const Closure& task, | 55 Closure task, |
56 TimeDelta delay) = 0; | 56 TimeDelta delay) = 0; |
57 | 57 |
58 // Returns a TaskRunner whose PostTask invocations result in scheduling tasks | 58 // Returns a TaskRunner whose PostTask invocations result in scheduling tasks |
59 // using |traits|. Tasks may run in any order and in parallel. | 59 // using |traits|. Tasks may run in any order and in parallel. |
60 virtual scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( | 60 virtual scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( |
61 const TaskTraits& traits) = 0; | 61 const TaskTraits& traits) = 0; |
62 | 62 |
63 // Returns a SequencedTaskRunner whose PostTask invocations result in | 63 // Returns a SequencedTaskRunner whose PostTask invocations result in |
64 // scheduling tasks using |traits|. Tasks run one at a time in posting order. | 64 // scheduling tasks using |traits|. Tasks run one at a time in posting order. |
65 virtual scoped_refptr<SequencedTaskRunner> | 65 virtual scoped_refptr<SequencedTaskRunner> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. | 151 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. |
152 // | 152 // |
153 // TODO(fdoray): Remove this method. https://crbug.com/687264 | 153 // TODO(fdoray): Remove this method. https://crbug.com/687264 |
154 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( | 154 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( |
155 const TaskTraits& traits) const = 0; | 155 const TaskTraits& traits) const = 0; |
156 }; | 156 }; |
157 | 157 |
158 } // namespace base | 158 } // namespace base |
159 | 159 |
160 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ | 160 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ |
OLD | NEW |