| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "jingle/glue/thread_wrapper.h" | 5 #include "jingle/glue/thread_wrapper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 talk_base::Message message; | 24 talk_base::Message message; |
| 25 base::WaitableEvent done_event; | 25 base::WaitableEvent done_event; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 base::LazyInstance<base::ThreadLocalPointer<JingleThreadWrapper> > | 28 base::LazyInstance<base::ThreadLocalPointer<JingleThreadWrapper> > |
| 29 g_jingle_thread_wrapper = LAZY_INSTANCE_INITIALIZER; | 29 g_jingle_thread_wrapper = LAZY_INSTANCE_INITIALIZER; |
| 30 | 30 |
| 31 // static | 31 // static |
| 32 void JingleThreadWrapper::EnsureForCurrentMessageLoop() { | 32 void JingleThreadWrapper::EnsureForCurrentMessageLoop() { |
| 33 if (JingleThreadWrapper::current() == NULL) { | 33 if (JingleThreadWrapper::current() == NULL) { |
| 34 MessageLoop* message_loop = MessageLoop::current(); | 34 base::MessageLoop* message_loop = base::MessageLoop::current(); |
| 35 g_jingle_thread_wrapper.Get().Set(new JingleThreadWrapper( | 35 g_jingle_thread_wrapper.Get() |
| 36 message_loop->message_loop_proxy())); | 36 .Set(new JingleThreadWrapper(message_loop->message_loop_proxy())); |
| 37 message_loop->AddDestructionObserver(current()); | 37 message_loop->AddDestructionObserver(current()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 DCHECK_EQ(talk_base::Thread::Current(), current()); | 40 DCHECK_EQ(talk_base::Thread::Current(), current()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 // static | 43 // static |
| 44 JingleThreadWrapper* JingleThreadWrapper::current() { | 44 JingleThreadWrapper* JingleThreadWrapper::current() { |
| 45 return g_jingle_thread_wrapper.Get().Get(); | 45 return g_jingle_thread_wrapper.Get().Get(); |
| 46 } | 46 } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 void JingleThreadWrapper::Stop() { | 294 void JingleThreadWrapper::Stop() { |
| 295 NOTREACHED(); | 295 NOTREACHED(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void JingleThreadWrapper::Run() { | 298 void JingleThreadWrapper::Run() { |
| 299 NOTREACHED(); | 299 NOTREACHED(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 } // namespace jingle_glue | 302 } // namespace jingle_glue |
| OLD | NEW |