| Index: base/threading/sequenced_worker_pool.h
|
| diff --git a/base/threading/sequenced_worker_pool.h b/base/threading/sequenced_worker_pool.h
|
| index 2bd3d581f5fb52eeac54c9d8ca229df9f115c603..dff01785850edcb868132cac0b3703f1f905832b 100644
|
| --- a/base/threading/sequenced_worker_pool.h
|
| +++ b/base/threading/sequenced_worker_pool.h
|
| @@ -17,10 +17,11 @@
|
| #include "base/base_export.h"
|
| #include "base/basictypes.h"
|
| #include "base/callback.h"
|
| +#include "base/compiler_specific.h"
|
| #include "base/memory/linked_ptr.h"
|
| -#include "base/memory/ref_counted.h"
|
| #include "base/synchronization/condition_variable.h"
|
| #include "base/synchronization/lock.h"
|
| +#include "base/task_runner.h"
|
| #include "base/tracked_objects.h"
|
|
|
| namespace base {
|
| @@ -55,8 +56,10 @@ namespace base {
|
| // not enforce shutdown semantics or allow us to specify how many worker
|
| // threads to run. For the typical use case of random background work, we don't
|
| // necessarily want to be super aggressive about creating threads.
|
| -class BASE_EXPORT SequencedWorkerPool
|
| - : public RefCountedThreadSafe<SequencedWorkerPool> {
|
| +//
|
| +// Note that SequencedWorkerPool is RefCountedThreadSafe (inherited
|
| +// from TaskRunner).
|
| +class BASE_EXPORT SequencedWorkerPool : public TaskRunner {
|
| public:
|
| // Defines what should happen to a task posted to the worker pool on shutdown.
|
| enum WorkerShutdown {
|
| @@ -195,6 +198,12 @@ class BASE_EXPORT SequencedWorkerPool
|
| const Closure& task,
|
| WorkerShutdown shutdown_behavior);
|
|
|
| + // TaskRunner implementation. Forwards to PostWorkerTask().
|
| + virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
|
| + const Closure& task,
|
| + int64 delay_ms) OVERRIDE;
|
| + virtual bool RunsTasksOnCurrentThread() const OVERRIDE;
|
| +
|
| // Blocks until all pending tasks are complete. This should only be called in
|
| // unit tests when you want to validate something that should have happened.
|
| //
|
| @@ -214,8 +223,10 @@ class BASE_EXPORT SequencedWorkerPool
|
| // and ownership of the pointer is kept with the caller.
|
| void SetTestingObserver(TestingObserver* observer);
|
|
|
| + protected:
|
| + virtual ~SequencedWorkerPool();
|
| +
|
| private:
|
| - friend class RefCountedThreadSafe<SequencedWorkerPool>;
|
| class Worker;
|
|
|
| struct SequencedTask {
|
| @@ -228,8 +239,6 @@ class BASE_EXPORT SequencedWorkerPool
|
| Closure task;
|
| };
|
|
|
| - ~SequencedWorkerPool();
|
| -
|
| // This function accepts a name and an ID. If the name is null, the
|
| // token ID is used. This allows us to implement the optional name lookup
|
| // from a single function without having to enter the lock a separate time.
|
|
|