OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_THREADING_SEQUENCED_TASK_RUNNER_IMPL_H_ |
| 6 #define BASE_THREADING_SEQUENCED_TASK_RUNNER_IMPL_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/sequenced_task_runner.h" |
| 13 #include "base/threading/sequenced_worker_pool.h" |
| 14 |
| 15 namespace base { |
| 16 |
| 17 // Note that this class is RefCountedThreadSafe (inherited from TaskRunner). |
| 18 class BASE_EXPORT SequencedTaskRunnerImpl |
| 19 : public base::SequencedTaskRunner, |
| 20 public base::SupportsWeakPtr<SequencedTaskRunnerImpl> { |
| 21 public: |
| 22 SequencedTaskRunnerImpl(scoped_refptr<SequencedWorkerPool> pool, |
| 23 SequencedWorkerPool::SequenceToken token); |
| 24 |
| 25 // TaskRunner implementation |
| 26 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 27 const Closure& task, |
| 28 int64 delay_ms) OVERRIDE; |
| 29 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 30 const Closure& task, |
| 31 TimeDelta delay) OVERRIDE; |
| 32 virtual bool RunsTasksOnCurrentThread() const OVERRIDE; |
| 33 |
| 34 // SequencedTaskRunner implementation |
| 35 virtual bool PostNonNestableDelayedTask( |
| 36 const tracked_objects::Location& from_here, |
| 37 const Closure& task, |
| 38 int64 delay_ms) OVERRIDE; |
| 39 virtual bool PostNonNestableDelayedTask( |
| 40 const tracked_objects::Location& from_here, |
| 41 const Closure& task, |
| 42 base::TimeDelta delay) OVERRIDE; |
| 43 |
| 44 private: |
| 45 ~SequencedTaskRunnerImpl(); |
| 46 |
| 47 scoped_refptr<SequencedWorkerPool> pool_; |
| 48 |
| 49 SequencedWorkerPool::SequenceToken token_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(SequencedTaskRunnerImpl); |
| 52 }; |
| 53 |
| 54 } // namespace base |
| 55 |
| 56 #endif // BASE_THREADING_SEQUENCED_TASK_RUNNER_IMPL_H_ |
OLD | NEW |