Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: remoting/jingle_glue/jingle_thread.h

Issue 7302002: Make JingleThreadMessageLoop usable without JingleThread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/jingle_glue/jingle_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 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"
(...skipping 12 matching lines...) Expand all
24 TaskPump(); 24 TaskPump();
25 25
26 // TaskRunner methods. 26 // TaskRunner methods.
27 virtual void WakeTasks(); 27 virtual void WakeTasks();
28 virtual int64 CurrentTime(); 28 virtual int64 CurrentTime();
29 29
30 // MessageHandler methods. 30 // MessageHandler methods.
31 virtual void OnMessage(talk_base::Message* pmsg); 31 virtual void OnMessage(talk_base::Message* pmsg);
32 }; 32 };
33 33
34 class JingleThreadMessageLoop : public MessageLoop {
35 public:
36 JingleThreadMessageLoop(talk_base::Thread* thread);
37 virtual ~JingleThreadMessageLoop();
38
39 private:
40 DISALLOW_COPY_AND_ASSIGN(JingleThreadMessageLoop);
41 };
42
34 // TODO(sergeyu): This class should be changed to inherit from Chromiums 43 // TODO(sergeyu): This class should be changed to inherit from Chromiums
35 // base::Thread instead of libjingle's thread. 44 // base::Thread instead of libjingle's thread.
36 class JingleThread : public talk_base::Thread, 45 class JingleThread : public talk_base::Thread,
37 public talk_base::MessageHandler { 46 public talk_base::MessageHandler {
38 public: 47 public:
39 JingleThread(); 48 JingleThread();
40 virtual ~JingleThread(); 49 virtual ~JingleThread();
41 50
42 void Start(); 51 void Start();
43 52
44 // Main function for the thread. Should not be called directly. 53 // Main function for the thread. Should not be called directly.
45 virtual void Run(); 54 virtual void Run();
46 55
47 // Stop the thread. 56 // Stop the thread.
48 virtual void Stop(); 57 virtual void Stop();
49 58
50 // Returns Chromiums message loop for this thread. 59 // Returns Chromiums message loop for this thread.
51 // TODO(sergeyu): remove this method when we use base::Thread instead of 60 // TODO(sergeyu): remove this method when we use base::Thread instead of
52 // talk_base::Thread 61 // talk_base::Thread
53 MessageLoop* message_loop(); 62 MessageLoop* message_loop();
54 63
55 // Returns task pump if the thread is running, otherwise NULL is returned. 64 // Returns task pump if the thread is running, otherwise NULL is returned.
56 TaskPump* task_pump(); 65 TaskPump* task_pump();
57 66
58 private: 67 private:
59 class JingleMessageLoop;
60 class JingleMessagePump;
61
62 virtual void OnMessage(talk_base::Message* msg); 68 virtual void OnMessage(talk_base::Message* msg);
63 69
64 TaskPump* task_pump_; 70 TaskPump* task_pump_;
65 base::WaitableEvent started_event_; 71 base::WaitableEvent started_event_;
66 base::WaitableEvent stopped_event_; 72 base::WaitableEvent stopped_event_;
67 MessageLoop* message_loop_; 73 MessageLoop* message_loop_;
68 74
69 DISALLOW_COPY_AND_ASSIGN(JingleThread); 75 DISALLOW_COPY_AND_ASSIGN(JingleThread);
70 }; 76 };
71 77
72 } // namespace remoting 78 } // namespace remoting
73 79
74 #endif // REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ 80 #endif // REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/jingle_glue/jingle_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698