| 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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 public: | 35 public: |
| 36 JingleThreadMessageLoop(talk_base::Thread* thread); | 36 JingleThreadMessageLoop(talk_base::Thread* thread); |
| 37 virtual ~JingleThreadMessageLoop(); | 37 virtual ~JingleThreadMessageLoop(); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(JingleThreadMessageLoop); | 40 DISALLOW_COPY_AND_ASSIGN(JingleThreadMessageLoop); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // TODO(sergeyu): This class should be changed to inherit from Chromiums | 43 // TODO(sergeyu): This class should be changed to inherit from Chromiums |
| 44 // base::Thread instead of libjingle's thread. | 44 // base::Thread instead of libjingle's thread. |
| 45 class JingleThread : public talk_base::Thread, | 45 class JingleThread : public talk_base::Thread { |
| 46 public talk_base::MessageHandler { | |
| 47 public: | 46 public: |
| 48 JingleThread(); | 47 JingleThread(); |
| 49 virtual ~JingleThread(); | 48 virtual ~JingleThread(); |
| 50 | 49 |
| 51 void Start(); | 50 void Start(); |
| 52 | 51 |
| 53 // Main function for the thread. Should not be called directly. | 52 // Main function for the thread. Should not be called directly. |
| 54 virtual void Run(); | 53 virtual void Run(); |
| 55 | 54 |
| 56 // Stop the thread. | 55 // Stop the thread. |
| 57 virtual void Stop(); | 56 virtual void Stop(); |
| 58 | 57 |
| 59 // Returns Chromiums message loop for this thread. | 58 // Returns Chromiums message loop for this thread. |
| 60 // TODO(sergeyu): remove this method when we use base::Thread instead of | 59 // TODO(sergeyu): remove this method when we use base::Thread instead of |
| 61 // talk_base::Thread | 60 // talk_base::Thread |
| 62 MessageLoop* message_loop(); | 61 MessageLoop* message_loop(); |
| 63 | 62 |
| 64 // 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. |
| 65 TaskPump* task_pump(); | 64 TaskPump* task_pump(); |
| 66 | 65 |
| 67 private: | 66 private: |
| 68 virtual void OnMessage(talk_base::Message* msg); | |
| 69 | |
| 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 | 71 |
| 75 DISALLOW_COPY_AND_ASSIGN(JingleThread); | 72 DISALLOW_COPY_AND_ASSIGN(JingleThread); |
| 76 }; | 73 }; |
| 77 | 74 |
| 78 } // namespace remoting | 75 } // namespace remoting |
| 79 | 76 |
| 80 #endif // REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ | 77 #endif // REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ |
| OLD | NEW |