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

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

Issue 2729523006: Remove the |max_threads| argument from CreateAndSetSimpleTaskScheduler(). (Closed)
Patch Set: fix build error Created 3 years, 9 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 | « no previous file | base/task_scheduler/task_scheduler.cc » ('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 <vector> 10 #include <vector>
10 11
11 #include "base/base_export.h" 12 #include "base/base_export.h"
12 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
15 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
16 #include "base/task_runner.h" 17 #include "base/task_runner.h"
17 #include "base/task_scheduler/task_traits.h" 18 #include "base/task_scheduler/task_traits.h"
18 #include "base/time/time.h" 19 #include "base/time/time.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 101
101 // CreateAndSetSimpleTaskScheduler(), CreateAndSetDefaultTaskScheduler(), and 102 // CreateAndSetSimpleTaskScheduler(), CreateAndSetDefaultTaskScheduler(), and
102 // SetInstance() register a TaskScheduler to handle tasks posted through the 103 // SetInstance() register a TaskScheduler to handle tasks posted through the
103 // post_task.h API for this process. The registered TaskScheduler will only be 104 // post_task.h API for this process. The registered TaskScheduler will only be
104 // deleted when a new TaskScheduler is registered and is leaked on shutdown. 105 // deleted when a new TaskScheduler is registered and is leaked on shutdown.
105 // The methods must not be called when TaskRunners created by the previous 106 // The methods must not be called when TaskRunners created by the previous
106 // TaskScheduler are still alive. The methods are not thread-safe; proper 107 // TaskScheduler are still alive. The methods are not thread-safe; proper
107 // synchronization is required to use the post_task.h API after registering a 108 // synchronization is required to use the post_task.h API after registering a
108 // new TaskScheduler. 109 // new TaskScheduler.
109 110
110 // Creates and sets a task scheduler with one worker pool that can have up to 111 #if !defined(OS_NACL)
111 // |max_threads| threads. CHECKs on failure. For tests, prefer 112 // Creates and sets a task scheduler using default params. |name| is used to
112 // base::test::ScopedTaskScheduler (ensures isolation). 113 // label threads and histograms. It should identify the component that calls
113 static void CreateAndSetSimpleTaskScheduler(int max_threads); 114 // this. CHECKs on failure. For tests, prefer base::test::ScopedTaskScheduler
115 // (ensures isolation).
116 static void CreateAndSetSimpleTaskScheduler(const std::string& name);
117 #endif // !defined(OS_NACL)
114 118
115 // Creates and sets a task scheduler with custom worker pools. CHECKs on 119 // Creates and sets a task scheduler with custom worker pools. CHECKs on
116 // failure. |worker_pool_params_vector| describes the worker pools to create. 120 // failure. |worker_pool_params_vector| describes the worker pools to create.
117 // |worker_pool_index_for_traits_callback| returns the index in |worker_pools| 121 // |worker_pool_index_for_traits_callback| returns the index in |worker_pools|
118 // of the worker pool in which a task with given traits should run. For tests, 122 // of the worker pool in which a task with given traits should run. For tests,
119 // prefer base::test::ScopedTaskScheduler (ensures isolation). 123 // prefer base::test::ScopedTaskScheduler (ensures isolation).
120 static void CreateAndSetDefaultTaskScheduler( 124 static void CreateAndSetDefaultTaskScheduler(
121 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector, 125 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector,
122 const WorkerPoolIndexForTraitsCallback& 126 const WorkerPoolIndexForTraitsCallback&
123 worker_pool_index_for_traits_callback); 127 worker_pool_index_for_traits_callback);
(...skipping 27 matching lines...) Expand all
151 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. 155 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items.
152 // 156 //
153 // TODO(fdoray): Remove this method. https://crbug.com/687264 157 // TODO(fdoray): Remove this method. https://crbug.com/687264
154 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( 158 virtual int GetMaxConcurrentTasksWithTraitsDeprecated(
155 const TaskTraits& traits) const = 0; 159 const TaskTraits& traits) const = 0;
156 }; 160 };
157 161
158 } // namespace base 162 } // namespace base
159 163
160 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 164 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | base/task_scheduler/task_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698