| 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 // Returns true if the current thread is processing a task with the given |
| 223 // sequence_token. |
| 224 bool IsRunningSequenceOnCurrentThread(SequenceToken sequence_token) const; |
| 225 |
| 222 // Blocks until all pending tasks are complete. This should only be called in | 226 // 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. | 227 // unit tests when you want to validate something that should have happened. |
| 224 // | 228 // |
| 225 // Note that calling this will not prevent other threads from posting work to | 229 // 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, | 230 // 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, | 231 // 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 | 232 // this doesn't come up since in a test, all the work is being posted from |
| 229 // the main thread. | 233 // the main thread. |
| 230 void FlushForTesting(); | 234 void FlushForTesting(); |
| 231 | 235 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 256 // Avoid pulling in too many headers by putting (almost) everything | 260 // Avoid pulling in too many headers by putting (almost) everything |
| 257 // into |inner_|. | 261 // into |inner_|. |
| 258 const scoped_ptr<Inner> inner_; | 262 const scoped_ptr<Inner> inner_; |
| 259 | 263 |
| 260 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 264 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
| 261 }; | 265 }; |
| 262 | 266 |
| 263 } // namespace base | 267 } // namespace base |
| 264 | 268 |
| 265 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 269 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
| OLD | NEW |