OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CC_BASE_WORKER_POOL_H_ | 5 #ifndef CC_BASE_WORKER_POOL_H_ |
6 #define CC_BASE_WORKER_POOL_H_ | 6 #define CC_BASE_WORKER_POOL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Tells the worker pool to shutdown and returns once all pending tasks have | 72 // Tells the worker pool to shutdown and returns once all pending tasks have |
73 // completed. | 73 // completed. |
74 virtual void Shutdown(); | 74 virtual void Shutdown(); |
75 | 75 |
76 // Set a new client. | 76 // Set a new client. |
77 void SetClient(WorkerPoolClient* client) { | 77 void SetClient(WorkerPoolClient* client) { |
78 client_ = client; | 78 client_ = client; |
79 } | 79 } |
80 | 80 |
81 // Force a check for completed tasks. | 81 // Force a check for completed tasks. |
82 void CheckForCompletedTasks(); | 82 virtual void CheckForCompletedTasks(); |
83 | 83 |
84 protected: | 84 protected: |
85 WorkerPool(size_t num_threads, | 85 WorkerPool(size_t num_threads, |
86 base::TimeDelta check_for_completed_tasks_delay, | 86 base::TimeDelta check_for_completed_tasks_delay, |
87 const std::string& thread_name_prefix); | 87 const std::string& thread_name_prefix); |
88 | 88 |
89 void ScheduleTasks(internal::WorkerPoolTask* root); | 89 void ScheduleTasks(internal::WorkerPoolTask* root); |
90 | 90 |
91 private: | 91 private: |
92 class Inner; | 92 class Inner; |
(...skipping 11 matching lines...) Expand all Loading... |
104 base::TimeDelta check_for_completed_tasks_delay_; | 104 base::TimeDelta check_for_completed_tasks_delay_; |
105 bool check_for_completed_tasks_pending_; | 105 bool check_for_completed_tasks_pending_; |
106 | 106 |
107 // Hide the gory details of the worker pool in |inner_|. | 107 // Hide the gory details of the worker pool in |inner_|. |
108 const scoped_ptr<Inner> inner_; | 108 const scoped_ptr<Inner> inner_; |
109 }; | 109 }; |
110 | 110 |
111 } // namespace cc | 111 } // namespace cc |
112 | 112 |
113 #endif // CC_BASE_WORKER_POOL_H_ | 113 #endif // CC_BASE_WORKER_POOL_H_ |
OLD | NEW |