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