OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 JINGLE_NOTIFIER_BASE_TASK_PUMP_H_ | 5 #ifndef JINGLE_NOTIFIER_BASE_TASK_PUMP_H_ |
6 #define JINGLE_NOTIFIER_BASE_TASK_PUMP_H_ | 6 #define JINGLE_NOTIFIER_BASE_TASK_PUMP_H_ |
7 | 7 |
| 8 #include "base/compiler_specific.h" |
8 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
9 #include "base/task.h" | 10 #include "base/task.h" |
10 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
11 #include "talk/base/taskrunner.h" | 12 #include "talk/base/taskrunner.h" |
12 | 13 |
13 namespace notifier { | 14 namespace notifier { |
14 | 15 |
15 class TaskPump : public talk_base::TaskRunner { | 16 class TaskPump : public talk_base::TaskRunner { |
16 public: | 17 public: |
17 TaskPump(); | 18 TaskPump(); |
18 | 19 |
19 virtual ~TaskPump(); | 20 virtual ~TaskPump(); |
20 | 21 |
21 // talk_base::TaskRunner implementation. | 22 // talk_base::TaskRunner implementation. |
22 virtual void WakeTasks(); | 23 virtual void WakeTasks() OVERRIDE; |
23 virtual int64 CurrentTime(); | 24 virtual int64 CurrentTime() OVERRIDE; |
24 | 25 |
25 // No tasks will be processed after this is called, even if | 26 // No tasks will be processed after this is called, even if |
26 // WakeTasks() is called. | 27 // WakeTasks() is called. |
27 void Stop(); | 28 void Stop(); |
28 | 29 |
29 private: | 30 private: |
30 void CheckAndRunTasks(); | 31 void CheckAndRunTasks(); |
31 | 32 |
32 base::NonThreadSafe non_thread_safe_; | 33 base::NonThreadSafe non_thread_safe_; |
33 base::WeakPtrFactory<TaskPump> weak_factory_; | 34 base::WeakPtrFactory<TaskPump> weak_factory_; |
34 bool posted_wake_; | 35 bool posted_wake_; |
35 bool stopped_; | 36 bool stopped_; |
36 | 37 |
37 DISALLOW_COPY_AND_ASSIGN(TaskPump); | 38 DISALLOW_COPY_AND_ASSIGN(TaskPump); |
38 }; | 39 }; |
39 | 40 |
40 } // namespace notifier | 41 } // namespace notifier |
41 | 42 |
42 #endif // JINGLE_NOTIFIER_BASE_TASK_PUMP_H_ | 43 #endif // JINGLE_NOTIFIER_BASE_TASK_PUMP_H_ |
OLD | NEW |