|
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> { | |
akalin
2012/03/15 19:17:35
It doesn't make sense for a ref-counted-thread-saf
| |
21 public: | |
22 explicit SequencedTaskRunnerImpl(scoped_refptr<SequencedWorkerPool> pool); | |
23 | |
24 SequencedTaskRunnerImpl(scoped_refptr<SequencedWorkerPool> pool, | |
akalin
2012/03/15 19:17:35
just one constructor, for pool + token
Francois
2012/03/18 16:28:29
Done.
| |
25 SequencedWorkerPool::SequenceToken token); | |
26 | |
27 SequencedTaskRunnerImpl(scoped_refptr<SequencedWorkerPool> pool, | |
28 const std::string& token_name); | |
29 | |
30 // TaskRunner implementation | |
31 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, | |
32 const Closure& task, | |
33 int64 delay_ms) OVERRIDE; | |
34 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, | |
35 const Closure& task, | |
36 TimeDelta delay) OVERRIDE; | |
37 virtual bool RunsTasksOnCurrentThread() const OVERRIDE; | |
38 | |
39 // SequencedTaskRunner implementation | |
40 virtual bool PostNonNestableDelayedTask( | |
41 const tracked_objects::Location& from_here, | |
42 const Closure& task, | |
43 int64 delay_ms) OVERRIDE; | |
44 virtual bool PostNonNestableDelayedTask( | |
45 const tracked_objects::Location& from_here, | |
46 const Closure& task, | |
47 base::TimeDelta delay) OVERRIDE; | |
48 | |
49 private: | |
50 ~SequencedTaskRunnerImpl(); | |
51 | |
52 scoped_refptr<SequencedWorkerPool> pool_; | |
53 | |
54 SequencedWorkerPool::SequenceToken token_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(SequencedTaskRunnerImpl); | |
57 }; | |
58 | |
59 } // namespace base | |
60 | |
61 #endif // BASE_THREADING_SEQUENCED_TASK_RUNNER_IMPL_H_ | |
OLD | NEW |