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

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

Issue 2873733003: Introduce SingleThreadTaskRunnerThreadMode (Closed)
Patch Set: Add missing "base" Created 3 years, 7 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 <vector> 9 #include <vector>
10 10
11 #include "base/base_export.h" 11 #include "base/base_export.h"
12 #include "base/callback.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/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "base/task_runner.h" 17 #include "base/task_runner.h"
18 #include "base/task_scheduler/scheduler_worker_pool_params.h" 18 #include "base/task_scheduler/scheduler_worker_pool_params.h"
19 #include "base/task_scheduler/single_thread_task_runner_thread_mode.h"
19 #include "base/task_scheduler/task_traits.h" 20 #include "base/task_scheduler/task_traits.h"
20 #include "base/time/time.h" 21 #include "base/time/time.h"
21 #include "build/build_config.h" 22 #include "build/build_config.h"
22 23
23 namespace gin { 24 namespace gin {
24 class V8Platform; 25 class V8Platform;
25 } 26 }
26 27
27 namespace tracked_objects { 28 namespace tracked_objects {
28 class Location; 29 class Location;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 86
86 // Returns a SequencedTaskRunner whose PostTask invocations result in 87 // Returns a SequencedTaskRunner whose PostTask invocations result in
87 // scheduling tasks using |traits|. Tasks run one at a time in posting order. 88 // scheduling tasks using |traits|. Tasks run one at a time in posting order.
88 virtual scoped_refptr<SequencedTaskRunner> 89 virtual scoped_refptr<SequencedTaskRunner>
89 CreateSequencedTaskRunnerWithTraits(const TaskTraits& traits) = 0; 90 CreateSequencedTaskRunnerWithTraits(const TaskTraits& traits) = 0;
90 91
91 // Returns a SingleThreadTaskRunner whose PostTask invocations result in 92 // Returns a SingleThreadTaskRunner whose PostTask invocations result in
92 // scheduling tasks using |traits|. Tasks run on a single thread in posting 93 // scheduling tasks using |traits|. Tasks run on a single thread in posting
93 // order. 94 // order.
94 virtual scoped_refptr<SingleThreadTaskRunner> 95 virtual scoped_refptr<SingleThreadTaskRunner>
95 CreateSingleThreadTaskRunnerWithTraits(const TaskTraits& traits) = 0; 96 CreateSingleThreadTaskRunnerWithTraits(
97 const TaskTraits& traits,
98 SingleThreadTaskRunnerThreadMode thread_mode =
99 SingleThreadTaskRunnerThreadMode::SHARED) = 0;
96 100
97 #if defined(OS_WIN) 101 #if defined(OS_WIN)
98 // Returns a SingleThreadTaskRunner whose PostTask invocations result in 102 // Returns a SingleThreadTaskRunner whose PostTask invocations result in
99 // scheduling tasks using |traits| in a COM Single-Threaded Apartment. Tasks 103 // scheduling tasks using |traits| in a COM Single-Threaded Apartment. Tasks
100 // run in the same Single-Threaded Apartment in posting order for the returned 104 // run in the same Single-Threaded Apartment in posting order for the returned
101 // SingleThreadTaskRunner. There is not necessarily a one-to-one 105 // SingleThreadTaskRunner. There is not necessarily a one-to-one
102 // correspondence between SingleThreadTaskRunners and Single-Threaded 106 // correspondence between SingleThreadTaskRunners and Single-Threaded
103 // Apartments. The implementation is free to share apartments or create new 107 // Apartments. The implementation is free to share apartments or create new
104 // apartments as necessary. In either case, care should be taken to make sure 108 // apartments as necessary. In either case, care should be taken to make sure
105 // COM pointers are not smuggled across apartments. 109 // COM pointers are not smuggled across apartments.
106 virtual scoped_refptr<SingleThreadTaskRunner> 110 virtual scoped_refptr<SingleThreadTaskRunner>
107 CreateCOMSTATaskRunnerWithTraits(const TaskTraits& traits) = 0; 111 CreateCOMSTATaskRunnerWithTraits(
112 const TaskTraits& traits,
113 SingleThreadTaskRunnerThreadMode thread_mode =
114 SingleThreadTaskRunnerThreadMode::SHARED) = 0;
108 #endif // defined(OS_WIN) 115 #endif // defined(OS_WIN)
109 116
110 // Returns a vector of all histograms available in this task scheduler. 117 // Returns a vector of all histograms available in this task scheduler.
111 virtual std::vector<const HistogramBase*> GetHistograms() const = 0; 118 virtual std::vector<const HistogramBase*> GetHistograms() const = 0;
112 119
113 // Synchronously shuts down the scheduler. Once this is called, only tasks 120 // Synchronously shuts down the scheduler. Once this is called, only tasks
114 // posted with the BLOCK_SHUTDOWN behavior will be run. When this returns: 121 // posted with the BLOCK_SHUTDOWN behavior will be run. When this returns:
115 // - All SKIP_ON_SHUTDOWN tasks that were already running have completed their 122 // - All SKIP_ON_SHUTDOWN tasks that were already running have completed their
116 // execution. 123 // execution.
117 // - All posted BLOCK_SHUTDOWN tasks have completed their execution. 124 // - All posted BLOCK_SHUTDOWN tasks have completed their execution.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. 203 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items.
197 // 204 //
198 // TODO(fdoray): Remove this method. https://crbug.com/687264 205 // TODO(fdoray): Remove this method. https://crbug.com/687264
199 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( 206 virtual int GetMaxConcurrentTasksWithTraitsDeprecated(
200 const TaskTraits& traits) const = 0; 207 const TaskTraits& traits) const = 0;
201 }; 208 };
202 209
203 } // namespace base 210 } // namespace base
204 211
205 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 212 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
OLDNEW
« no previous file with comments | « base/task_scheduler/single_thread_task_runner_thread_mode.h ('k') | base/task_scheduler/task_scheduler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698