OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_THREADING_SEQUENCED_WORKER_POOL_H_ | 5 #ifndef BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // | 165 // |
166 // The task will be guaranteed to run to completion before shutdown | 166 // The task will be guaranteed to run to completion before shutdown |
167 // (BLOCK_SHUTDOWN semantics). | 167 // (BLOCK_SHUTDOWN semantics). |
168 // | 168 // |
169 // Returns true if the task was posted successfully. This may fail during | 169 // Returns true if the task was posted successfully. This may fail during |
170 // shutdown regardless of the specified ShutdownBehavior. | 170 // shutdown regardless of the specified ShutdownBehavior. |
171 bool PostSequencedWorkerTask(SequenceToken sequence_token, | 171 bool PostSequencedWorkerTask(SequenceToken sequence_token, |
172 const tracked_objects::Location& from_here, | 172 const tracked_objects::Location& from_here, |
173 const base::Closure& task); | 173 const base::Closure& task); |
174 | 174 |
| 175 // Like PostSequencedWorkerTask above, but allows you to specify a named |
| 176 // token, which saves an extra call to GetNamedSequenceToken. |
| 177 bool PostNamedSequencedWorkerTask(const std::string& token_name, |
| 178 const tracked_objects::Location& from_here, |
| 179 const base::Closure& task); |
| 180 |
175 // Same as PostSequencedWorkerTask but allows specification of the shutdown | 181 // Same as PostSequencedWorkerTask but allows specification of the shutdown |
176 // behavior. | 182 // behavior. |
177 bool PostSequencedWorkerTaskWithShutdownBehavior( | 183 bool PostSequencedWorkerTaskWithShutdownBehavior( |
178 SequenceToken sequence_token, | 184 SequenceToken sequence_token, |
179 const tracked_objects::Location& from_here, | 185 const tracked_objects::Location& from_here, |
180 const base::Closure& task, | 186 const base::Closure& task, |
181 WorkerShutdown shutdown_behavior); | 187 WorkerShutdown shutdown_behavior); |
182 | 188 |
183 // Implements the worker pool shutdown. This should be called during app | 189 // Implements the worker pool shutdown. This should be called during app |
184 // shutdown, and will discard/join with appropriate tasks before returning. | 190 // shutdown, and will discard/join with appropriate tasks before returning. |
(...skipping 12 matching lines...) Expand all Loading... |
197 friend class Worker; | 203 friend class Worker; |
198 | 204 |
199 scoped_refptr<Inner> inner_; | 205 scoped_refptr<Inner> inner_; |
200 | 206 |
201 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 207 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
202 }; | 208 }; |
203 | 209 |
204 } // namespace base | 210 } // namespace base |
205 | 211 |
206 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 212 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
OLD | NEW |