| 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 | |
| 181 // Same as PostSequencedWorkerTask but allows specification of the shutdown | 175 // Same as PostSequencedWorkerTask but allows specification of the shutdown |
| 182 // behavior. | 176 // behavior. |
| 183 bool PostSequencedWorkerTaskWithShutdownBehavior( | 177 bool PostSequencedWorkerTaskWithShutdownBehavior( |
| 184 SequenceToken sequence_token, | 178 SequenceToken sequence_token, |
| 185 const tracked_objects::Location& from_here, | 179 const tracked_objects::Location& from_here, |
| 186 const base::Closure& task, | 180 const base::Closure& task, |
| 187 WorkerShutdown shutdown_behavior); | 181 WorkerShutdown shutdown_behavior); |
| 188 | 182 |
| 189 // Implements the worker pool shutdown. This should be called during app | 183 // Implements the worker pool shutdown. This should be called during app |
| 190 // shutdown, and will discard/join with appropriate tasks before returning. | 184 // shutdown, and will discard/join with appropriate tasks before returning. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 203 friend class Worker; | 197 friend class Worker; |
| 204 | 198 |
| 205 scoped_refptr<Inner> inner_; | 199 scoped_refptr<Inner> inner_; |
| 206 | 200 |
| 207 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 201 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
| 208 }; | 202 }; |
| 209 | 203 |
| 210 } // namespace base | 204 } // namespace base |
| 211 | 205 |
| 212 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 206 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
| OLD | NEW |