OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <cstddef> | 9 #include <cstddef> |
10 #include <string> | 10 #include <string> |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 // TaskRunner implementation. Forwards to PostWorkerTask(). | 213 // TaskRunner implementation. Forwards to PostWorkerTask(). |
214 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, | 214 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, |
215 const Closure& task, | 215 const Closure& task, |
216 int64 delay_ms) OVERRIDE; | 216 int64 delay_ms) OVERRIDE; |
217 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, | 217 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, |
218 const Closure& task, | 218 const Closure& task, |
219 TimeDelta delay) OVERRIDE; | 219 TimeDelta delay) OVERRIDE; |
220 virtual bool RunsTasksOnCurrentThread() const OVERRIDE; | 220 virtual bool RunsTasksOnCurrentThread() const OVERRIDE; |
221 | 221 |
| 222 bool IsRunningSequenceOnCurrentThread(SequenceToken sequence_token) const; |
| 223 |
222 // Blocks until all pending tasks are complete. This should only be called in | 224 // Blocks until all pending tasks are complete. This should only be called in |
223 // unit tests when you want to validate something that should have happened. | 225 // unit tests when you want to validate something that should have happened. |
224 // | 226 // |
225 // Note that calling this will not prevent other threads from posting work to | 227 // Note that calling this will not prevent other threads from posting work to |
226 // the queue while the calling thread is waiting on Flush(). In this case, | 228 // the queue while the calling thread is waiting on Flush(). In this case, |
227 // Flush will return only when there's no more work in the queue. Normally, | 229 // Flush will return only when there's no more work in the queue. Normally, |
228 // this doesn't come up since in a test, all the work is being posted from | 230 // this doesn't come up since in a test, all the work is being posted from |
229 // the main thread. | 231 // the main thread. |
230 void FlushForTesting(); | 232 void FlushForTesting(); |
231 | 233 |
(...skipping 24 matching lines...) Expand all Loading... |
256 // Avoid pulling in too many headers by putting (almost) everything | 258 // Avoid pulling in too many headers by putting (almost) everything |
257 // into |inner_|. | 259 // into |inner_|. |
258 const scoped_ptr<Inner> inner_; | 260 const scoped_ptr<Inner> inner_; |
259 | 261 |
260 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 262 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
261 }; | 263 }; |
262 | 264 |
263 } // namespace base | 265 } // namespace base |
264 | 266 |
265 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 267 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
OLD | NEW |