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_SCHEDULER_WORKER_POOL_PARAMS_H_ | 5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_PARAMS_H_ |
6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_PARAMS_H_ | 6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_PARAMS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/task_scheduler/scheduler_worker_params.h" | 10 #include "base/task_scheduler/scheduler_worker_params.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // Construct a scheduler worker pool parameter object. |name| will be used to | 26 // Construct a scheduler worker pool parameter object. |name| will be used to |
27 // label the pool's threads ("TaskScheduler" + |name| + index) and histograms | 27 // label the pool's threads ("TaskScheduler" + |name| + index) and histograms |
28 // ("TaskScheduler." + histogram name + "." + |name| + extra suffixes). The | 28 // ("TaskScheduler." + histogram name + "." + |name| + extra suffixes). The |
29 // pool will contain up to |max_threads|. |priority_hint| is the preferred | 29 // pool will contain up to |max_threads|. |priority_hint| is the preferred |
30 // thread priority; the actual thread priority depends on shutdown state and | 30 // thread priority; the actual thread priority depends on shutdown state and |
31 // platform capabilities. |standby_thread_policy| indicates whether an idle | 31 // platform capabilities. |standby_thread_policy| indicates whether an idle |
32 // thread should be kept alive on standby. |suggested_reclaim_time| sets a | 32 // thread should be kept alive on standby. |suggested_reclaim_time| sets a |
33 // suggestion on when to reclaim idle threads. The pool is free to ignore this | 33 // suggestion on when to reclaim idle threads. The pool is free to ignore this |
34 // value for performance or correctness reasons. |backward_compatibility| | 34 // value for performance or correctness reasons. |backward_compatibility| |
35 // indicates whether backward compatibility is enabled. | 35 // indicates whether backward compatibility is enabled. |
| 36 // |
| 37 // TODO(fdoray): Remove this constructor. https://crbug.com/690706 |
36 SchedulerWorkerPoolParams( | 38 SchedulerWorkerPoolParams( |
37 const std::string& name, | 39 const std::string& name, |
38 ThreadPriority priority_hint, | 40 ThreadPriority priority_hint, |
39 StandbyThreadPolicy standby_thread_policy, | 41 StandbyThreadPolicy standby_thread_policy, |
40 int max_threads, | 42 int max_threads, |
41 TimeDelta suggested_reclaim_time, | 43 TimeDelta suggested_reclaim_time, |
42 SchedulerBackwardCompatibility backward_compatibility = | 44 SchedulerBackwardCompatibility backward_compatibility = |
43 SchedulerBackwardCompatibility::DISABLED); | 45 SchedulerBackwardCompatibility::DISABLED); |
| 46 |
| 47 // Same as above, with no explicit |name| and |priority_hint|. |
| 48 SchedulerWorkerPoolParams( |
| 49 StandbyThreadPolicy standby_thread_policy, |
| 50 int max_threads, |
| 51 TimeDelta suggested_reclaim_time, |
| 52 SchedulerBackwardCompatibility backward_compatibility = |
| 53 SchedulerBackwardCompatibility::DISABLED); |
| 54 |
44 SchedulerWorkerPoolParams(const SchedulerWorkerPoolParams& other); | 55 SchedulerWorkerPoolParams(const SchedulerWorkerPoolParams& other); |
45 SchedulerWorkerPoolParams& operator=(const SchedulerWorkerPoolParams& other); | 56 SchedulerWorkerPoolParams& operator=(const SchedulerWorkerPoolParams& other); |
46 | 57 |
47 const std::string& name() const { return name_; } | 58 const std::string& name() const { return name_; } |
48 ThreadPriority priority_hint() const { return priority_hint_; } | 59 ThreadPriority priority_hint() const { return priority_hint_; } |
49 StandbyThreadPolicy standby_thread_policy() const { | 60 StandbyThreadPolicy standby_thread_policy() const { |
50 return standby_thread_policy_; | 61 return standby_thread_policy_; |
51 } | 62 } |
52 size_t max_threads() const { return max_threads_; } | 63 size_t max_threads() const { return max_threads_; } |
53 TimeDelta suggested_reclaim_time() const { return suggested_reclaim_time_; } | 64 TimeDelta suggested_reclaim_time() const { return suggested_reclaim_time_; } |
54 SchedulerBackwardCompatibility backward_compatibility() const { | 65 SchedulerBackwardCompatibility backward_compatibility() const { |
55 return backward_compatibility_; | 66 return backward_compatibility_; |
56 } | 67 } |
57 | 68 |
58 private: | 69 private: |
| 70 // TODO(fdoray): Remove |name_| and |priority_hint_|. https://crbug.com/690706 |
59 std::string name_; | 71 std::string name_; |
60 ThreadPriority priority_hint_; | 72 ThreadPriority priority_hint_; |
61 StandbyThreadPolicy standby_thread_policy_; | 73 StandbyThreadPolicy standby_thread_policy_; |
62 size_t max_threads_; | 74 size_t max_threads_; |
63 TimeDelta suggested_reclaim_time_; | 75 TimeDelta suggested_reclaim_time_; |
64 SchedulerBackwardCompatibility backward_compatibility_; | 76 SchedulerBackwardCompatibility backward_compatibility_; |
65 }; | 77 }; |
66 | 78 |
67 } // namespace base | 79 } // namespace base |
68 | 80 |
69 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_PARAMS_H_ | 81 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_PARAMS_H_ |
OLD | NEW |