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

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

Issue 2768873007: Add Support to Get a COM STA Task Runner from the Task Scheduler API (Closed)
Patch Set: Simplify COM Init for ScopedTaskScheduler Created 3 years, 8 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
« no previous file with comments | « base/task_scheduler/post_task.cc ('k') | base/task_scheduler/task_scheduler_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_forward.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 #include "build/build_config.h"
20 21
21 namespace gin { 22 namespace gin {
22 class V8Platform; 23 class V8Platform;
23 } 24 }
24 25
25 namespace tracked_objects { 26 namespace tracked_objects {
26 class Location; 27 class Location;
27 } 28 }
28 29
29 namespace base { 30 namespace base {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // scheduling tasks using |traits|. Tasks run one at a time in posting order. 66 // scheduling tasks using |traits|. Tasks run one at a time in posting order.
66 virtual scoped_refptr<SequencedTaskRunner> 67 virtual scoped_refptr<SequencedTaskRunner>
67 CreateSequencedTaskRunnerWithTraits(const TaskTraits& traits) = 0; 68 CreateSequencedTaskRunnerWithTraits(const TaskTraits& traits) = 0;
68 69
69 // Returns a SingleThreadTaskRunner whose PostTask invocations result in 70 // Returns a SingleThreadTaskRunner whose PostTask invocations result in
70 // scheduling tasks using |traits|. Tasks run on a single thread in posting 71 // scheduling tasks using |traits|. Tasks run on a single thread in posting
71 // order. 72 // order.
72 virtual scoped_refptr<SingleThreadTaskRunner> 73 virtual scoped_refptr<SingleThreadTaskRunner>
73 CreateSingleThreadTaskRunnerWithTraits(const TaskTraits& traits) = 0; 74 CreateSingleThreadTaskRunnerWithTraits(const TaskTraits& traits) = 0;
74 75
76 #if defined(OS_WIN)
77 // Returns a SingleThreadTaskRunner whose PostTask invocations result in
78 // scheduling tasks using |traits| in a COM Single-Threaded Apartment. Tasks
79 // run in the same Single-Threaded Apartment in posting order for the returned
80 // SingleThreadTaskRunner. There is not necessarily a one-to-one
81 // correspondence between SingleThreadTaskRunners and Single-Threaded
82 // Apartments. The implementation is free to share apartments or create new
83 // apartments as necessary. In either case, care should be taken to make sure
84 // COM pointers are not smuggled across apartments.
85 virtual scoped_refptr<SingleThreadTaskRunner>
86 CreateCOMSTATaskRunnerWithTraits(const TaskTraits& traits) = 0;
87 #endif // defined(OS_WIN)
88
75 // Returns a vector of all histograms available in this task scheduler. 89 // Returns a vector of all histograms available in this task scheduler.
76 virtual std::vector<const HistogramBase*> GetHistograms() const = 0; 90 virtual std::vector<const HistogramBase*> GetHistograms() const = 0;
77 91
78 // Synchronously shuts down the scheduler. Once this is called, only tasks 92 // Synchronously shuts down the scheduler. Once this is called, only tasks
79 // posted with the BLOCK_SHUTDOWN behavior will be run. When this returns: 93 // posted with the BLOCK_SHUTDOWN behavior will be run. When this returns:
80 // - All SKIP_ON_SHUTDOWN tasks that were already running have completed their 94 // - All SKIP_ON_SHUTDOWN tasks that were already running have completed their
81 // execution. 95 // execution.
82 // - All posted BLOCK_SHUTDOWN tasks have completed their execution. 96 // - All posted BLOCK_SHUTDOWN tasks have completed their execution.
83 // - CONTINUE_ON_SHUTDOWN tasks might still be running. 97 // - CONTINUE_ON_SHUTDOWN tasks might still be running.
84 // Note that an implementation can keep threads and other resources alive to 98 // Note that an implementation can keep threads and other resources alive to
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. 169 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items.
156 // 170 //
157 // TODO(fdoray): Remove this method. https://crbug.com/687264 171 // TODO(fdoray): Remove this method. https://crbug.com/687264
158 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( 172 virtual int GetMaxConcurrentTasksWithTraitsDeprecated(
159 const TaskTraits& traits) const = 0; 173 const TaskTraits& traits) const = 0;
160 }; 174 };
161 175
162 } // namespace base 176 } // namespace base
163 177
164 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 178 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
OLDNEW
« no previous file with comments | « base/task_scheduler/post_task.cc ('k') | base/task_scheduler/task_scheduler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698