OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/waitable_event.h" | 10 #include "base/waitable_event.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // base::Thread instead of libjingle's thread. | 35 // base::Thread instead of libjingle's thread. |
36 class JingleThread : public talk_base::Thread, | 36 class JingleThread : public talk_base::Thread, |
37 public talk_base::MessageHandler { | 37 public talk_base::MessageHandler { |
38 public: | 38 public: |
39 JingleThread(); | 39 JingleThread(); |
40 virtual ~JingleThread(); | 40 virtual ~JingleThread(); |
41 | 41 |
42 void Start(); | 42 void Start(); |
43 | 43 |
44 // Main function for the thread. Should not be called directly. | 44 // Main function for the thread. Should not be called directly. |
45 void Run(); | 45 virtual void Run(); |
46 | 46 |
47 // Stop the thread. | 47 // Stop the thread. |
48 void Stop(); | 48 virtual void Stop(); |
49 | 49 |
50 // Returns Chromiums message loop for this thread. | 50 // Returns Chromiums message loop for this thread. |
51 // TODO(sergeyu): remove this method when we use base::Thread instead of | 51 // TODO(sergeyu): remove this method when we use base::Thread instead of |
52 // talk_base::Thread | 52 // talk_base::Thread |
53 MessageLoop* message_loop(); | 53 MessageLoop* message_loop(); |
54 | 54 |
55 // Returns task pump if the thread is running, otherwise NULL is returned. | 55 // Returns task pump if the thread is running, otherwise NULL is returned. |
56 TaskPump* task_pump(); | 56 TaskPump* task_pump(); |
57 | 57 |
58 private: | 58 private: |
59 class JingleMessageLoop; | 59 class JingleMessageLoop; |
60 class JingleMessagePump; | 60 class JingleMessagePump; |
61 | 61 |
62 friend class HeartbeatSenderTest; | 62 friend class HeartbeatSenderTest; |
63 | 63 |
64 virtual void OnMessage(talk_base::Message* msg); | 64 virtual void OnMessage(talk_base::Message* msg); |
65 | 65 |
66 TaskPump* task_pump_; | 66 TaskPump* task_pump_; |
67 base::WaitableEvent started_event_; | 67 base::WaitableEvent started_event_; |
68 base::WaitableEvent stopped_event_; | 68 base::WaitableEvent stopped_event_; |
69 MessageLoop* message_loop_; | 69 MessageLoop* message_loop_; |
70 | 70 |
71 DISALLOW_COPY_AND_ASSIGN(JingleThread); | 71 DISALLOW_COPY_AND_ASSIGN(JingleThread); |
72 }; | 72 }; |
73 | 73 |
74 } // namespace remoting | 74 } // namespace remoting |
75 | 75 |
76 #endif // REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ | 76 #endif // REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ |
OLD | NEW |