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 REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ | 5 #ifndef REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ |
6 #define REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ | 6 #define REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ |
7 | 7 |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/tracked_objects.h" | 9 #include "base/tracked_objects.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 #include "third_party/libjingle/source/talk/base/messagequeue.h" | 11 #include "third_party/libjingle/source/talk/base/messagequeue.h" |
12 #include "third_party/libjingle/source/talk/base/taskrunner.h" | 12 #include "third_party/libjingle/source/talk/base/taskrunner.h" |
13 #include "third_party/libjingle/source/talk/base/thread.h" | 13 #include "third_party/libjingle/source/talk/base/thread.h" |
14 | 14 |
15 namespace base { | |
16 class MessageLoopProxy; | |
17 } // namespace base | |
18 | |
19 namespace buzz { | 15 namespace buzz { |
20 class XmppClient; | 16 class XmppClient; |
21 } // namespace buzz | 17 } |
22 | 18 |
23 namespace remoting { | 19 namespace remoting { |
24 | 20 |
25 class TaskPump : public talk_base::MessageHandler, | 21 class TaskPump : public talk_base::MessageHandler, |
26 public talk_base::TaskRunner { | 22 public talk_base::TaskRunner { |
27 public: | 23 public: |
28 TaskPump(); | 24 TaskPump(); |
29 | 25 |
30 // TaskRunner methods. | 26 // TaskRunner methods. |
31 virtual void WakeTasks(); | 27 virtual void WakeTasks(); |
(...skipping 21 matching lines...) Expand all Loading... |
53 | 49 |
54 void Start(); | 50 void Start(); |
55 | 51 |
56 // Main function for the thread. Should not be called directly. | 52 // Main function for the thread. Should not be called directly. |
57 virtual void Run(); | 53 virtual void Run(); |
58 | 54 |
59 // Stop the thread. | 55 // Stop the thread. |
60 virtual void Stop(); | 56 virtual void Stop(); |
61 | 57 |
62 // Returns Chromiums message loop for this thread. | 58 // Returns Chromiums message loop for this thread. |
| 59 // TODO(sergeyu): remove this method when we use base::Thread instead of |
| 60 // talk_base::Thread |
63 MessageLoop* message_loop(); | 61 MessageLoop* message_loop(); |
64 base::MessageLoopProxy* message_loop_proxy(); | |
65 | 62 |
66 // Returns task pump if the thread is running, otherwise NULL is returned. | 63 // Returns task pump if the thread is running, otherwise NULL is returned. |
67 TaskPump* task_pump(); | 64 TaskPump* task_pump(); |
68 | 65 |
69 private: | 66 private: |
70 TaskPump* task_pump_; | 67 TaskPump* task_pump_; |
71 base::WaitableEvent started_event_; | 68 base::WaitableEvent started_event_; |
72 base::WaitableEvent stopped_event_; | 69 base::WaitableEvent stopped_event_; |
73 MessageLoop* message_loop_; | 70 MessageLoop* message_loop_; |
74 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | |
75 | 71 |
76 DISALLOW_COPY_AND_ASSIGN(JingleThread); | 72 DISALLOW_COPY_AND_ASSIGN(JingleThread); |
77 }; | 73 }; |
78 | 74 |
79 } // namespace remoting | 75 } // namespace remoting |
80 | 76 |
81 #endif // REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ | 77 #endif // REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ |
OLD | NEW |