diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 23:07:05 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 23:07:05 +0000 |
commit | 60fc9600a685d2e8c29c9ad81b167549fb223fd3 (patch) | |
tree | 1b9fac808def5132230fa240066540640951b5bc /remoting/jingle_glue | |
parent | 28b50a7b55c56a941f948fc4e8de8c06cb46fc3c (diff) | |
download | chromium_src-60fc9600a685d2e8c29c9ad81b167549fb223fd3.zip chromium_src-60fc9600a685d2e8c29c9ad81b167549fb223fd3.tar.gz chromium_src-60fc9600a685d2e8c29c9ad81b167549fb223fd3.tar.bz2 |
Use MessageLoopProxy for network message loop.
When we switch to P2P Pepper API we will need to run networking code on the
main plugin thread. Switching to MessageLoopProxy for network thread, so that
it's easier to switch network thread in the future.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7633009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96651 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/jingle_glue')
-rw-r--r-- | remoting/jingle_glue/jingle_thread.cc | 6 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_thread.h | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/remoting/jingle_glue/jingle_thread.cc b/remoting/jingle_glue/jingle_thread.cc index b0b409a..2dc37ad 100644 --- a/remoting/jingle_glue/jingle_thread.cc +++ b/remoting/jingle_glue/jingle_thread.cc @@ -6,6 +6,7 @@ #include "base/basictypes.h" #include "base/logging.h" +#include "base/message_loop_proxy.h" #include "base/message_pump.h" #include "base/time.h" #include "third_party/libjingle/source/talk/base/ssladapter.h" @@ -153,6 +154,7 @@ void JingleThread::Start() { void JingleThread::Run() { JingleThreadMessageLoop message_loop(this); message_loop_ = &message_loop; + message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); TaskPump task_pump; task_pump_ = &task_pump; @@ -180,6 +182,10 @@ MessageLoop* JingleThread::message_loop() { return message_loop_; } +base::MessageLoopProxy* JingleThread::message_loop_proxy() { + return message_loop_proxy_; +} + TaskPump* JingleThread::task_pump() { return task_pump_; } diff --git a/remoting/jingle_glue/jingle_thread.h b/remoting/jingle_glue/jingle_thread.h index 35b46f2..80924a21 100644 --- a/remoting/jingle_glue/jingle_thread.h +++ b/remoting/jingle_glue/jingle_thread.h @@ -12,9 +12,13 @@ #include "third_party/libjingle/source/talk/base/taskrunner.h" #include "third_party/libjingle/source/talk/base/thread.h" +namespace base { +class MessageLoopProxy; +} // namespace base + namespace buzz { class XmppClient; -} +} // namespace buzz namespace remoting { @@ -56,9 +60,8 @@ class JingleThread : public talk_base::Thread { virtual void Stop(); // Returns Chromiums message loop for this thread. - // TODO(sergeyu): remove this method when we use base::Thread instead of - // talk_base::Thread MessageLoop* message_loop(); + base::MessageLoopProxy* message_loop_proxy(); // Returns task pump if the thread is running, otherwise NULL is returned. TaskPump* task_pump(); @@ -68,6 +71,7 @@ class JingleThread : public talk_base::Thread { base::WaitableEvent started_event_; base::WaitableEvent stopped_event_; MessageLoop* message_loop_; + scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; DISALLOW_COPY_AND_ASSIGN(JingleThread); }; |