| 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 JINGLE_GLUE_TASK_PUMP_H_ | 5 #ifndef JINGLE_GLUE_TASK_PUMP_H_ |
| 6 #define JINGLE_GLUE_TASK_PUMP_H_ | 6 #define JINGLE_GLUE_TASK_PUMP_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/threading/non_thread_safe.h" | 13 #include "base/sequence_checker.h" |
| 14 #include "third_party/libjingle_xmpp/task_runner/taskrunner.h" | 14 #include "third_party/libjingle_xmpp/task_runner/taskrunner.h" |
| 15 | 15 |
| 16 namespace jingle_glue { | 16 namespace jingle_glue { |
| 17 | 17 |
| 18 // rtc::TaskRunner implementation that works on chromium threads. | 18 // rtc::TaskRunner implementation that works on chromium threads. |
| 19 class TaskPump : public rtc::TaskRunner, public base::NonThreadSafe { | 19 class TaskPump : public rtc::TaskRunner { |
| 20 public: | 20 public: |
| 21 TaskPump(); | 21 TaskPump(); |
| 22 | 22 |
| 23 ~TaskPump() override; | 23 ~TaskPump() override; |
| 24 | 24 |
| 25 // rtc::TaskRunner implementation. | 25 // rtc::TaskRunner implementation. |
| 26 void WakeTasks() override; | 26 void WakeTasks() override; |
| 27 int64_t CurrentTime() override; | 27 int64_t CurrentTime() override; |
| 28 | 28 |
| 29 // No tasks will be processed after this is called, even if | 29 // No tasks will be processed after this is called, even if |
| 30 // WakeTasks() is called. | 30 // WakeTasks() is called. |
| 31 void Stop(); | 31 void Stop(); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 void CheckAndRunTasks(); | 34 void CheckAndRunTasks(); |
| 35 | 35 |
| 36 bool posted_wake_; | 36 bool posted_wake_; |
| 37 bool stopped_; | 37 bool stopped_; |
| 38 | 38 |
| 39 SEQUENCE_CHECKER(sequence_checker_); |
| 40 |
| 39 base::WeakPtrFactory<TaskPump> weak_factory_; | 41 base::WeakPtrFactory<TaskPump> weak_factory_; |
| 40 | 42 |
| 41 DISALLOW_COPY_AND_ASSIGN(TaskPump); | 43 DISALLOW_COPY_AND_ASSIGN(TaskPump); |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 } // namespace jingle_glue | 46 } // namespace jingle_glue |
| 45 | 47 |
| 46 #endif // JINGLE_GLUE_TASK_PUMP_H_ | 48 #endif // JINGLE_GLUE_TASK_PUMP_H_ |
| OLD | NEW |