| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // behavior. | 224 // behavior. |
| 225 bool PostSequencedWorkerTaskWithShutdownBehavior( | 225 bool PostSequencedWorkerTaskWithShutdownBehavior( |
| 226 SequenceToken sequence_token, | 226 SequenceToken sequence_token, |
| 227 const tracked_objects::Location& from_here, | 227 const tracked_objects::Location& from_here, |
| 228 const Closure& task, | 228 const Closure& task, |
| 229 WorkerShutdown shutdown_behavior); | 229 WorkerShutdown shutdown_behavior); |
| 230 | 230 |
| 231 // TaskRunner implementation. Forwards to PostWorkerTask(). | 231 // TaskRunner implementation. Forwards to PostWorkerTask(). |
| 232 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, | 232 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 233 const Closure& task, | 233 const Closure& task, |
| 234 int64 delay_ms) OVERRIDE; | |
| 235 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, | |
| 236 const Closure& task, | |
| 237 TimeDelta delay) OVERRIDE; | 234 TimeDelta delay) OVERRIDE; |
| 238 virtual bool RunsTasksOnCurrentThread() const OVERRIDE; | 235 virtual bool RunsTasksOnCurrentThread() const OVERRIDE; |
| 239 | 236 |
| 240 // Returns true if the current thread is processing a task with the given | 237 // Returns true if the current thread is processing a task with the given |
| 241 // sequence_token. | 238 // sequence_token. |
| 242 bool IsRunningSequenceOnCurrentThread(SequenceToken sequence_token) const; | 239 bool IsRunningSequenceOnCurrentThread(SequenceToken sequence_token) const; |
| 243 | 240 |
| 244 // Blocks until all pending tasks are complete. This should only be called in | 241 // Blocks until all pending tasks are complete. This should only be called in |
| 245 // unit tests when you want to validate something that should have happened. | 242 // unit tests when you want to validate something that should have happened. |
| 246 // | 243 // |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // Avoid pulling in too many headers by putting (almost) everything | 275 // Avoid pulling in too many headers by putting (almost) everything |
| 279 // into |inner_|. | 276 // into |inner_|. |
| 280 const scoped_ptr<Inner> inner_; | 277 const scoped_ptr<Inner> inner_; |
| 281 | 278 |
| 282 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 279 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
| 283 }; | 280 }; |
| 284 | 281 |
| 285 } // namespace base | 282 } // namespace base |
| 286 | 283 |
| 287 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 284 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
| OLD | NEW |