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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 return g_jingle_thread_wrapper.Get().Get(); | 42 return g_jingle_thread_wrapper.Get().Get(); |
43 } | 43 } |
44 | 44 |
45 JingleThreadWrapper::JingleThreadWrapper(MessageLoop* message_loop) | 45 JingleThreadWrapper::JingleThreadWrapper(MessageLoop* message_loop) |
46 : message_loop_(message_loop), | 46 : message_loop_(message_loop), |
47 send_allowed_(false), | 47 send_allowed_(false), |
48 last_task_id_(0), | 48 last_task_id_(0), |
49 pending_send_event_(true, false) { | 49 pending_send_event_(true, false) { |
50 DCHECK_EQ(message_loop_, MessageLoop::current()); | 50 DCHECK_EQ(message_loop_, MessageLoop::current()); |
51 | 51 |
| 52 delete talk_base::ThreadManager::Instance()->CurrentThread(); |
52 talk_base::ThreadManager::Instance()->SetCurrentThread(this); | 53 talk_base::ThreadManager::Instance()->SetCurrentThread(this); |
53 talk_base::MessageQueueManager::Instance()->Add(this); | 54 talk_base::MessageQueueManager::Instance()->Add(this); |
54 message_loop_->AddDestructionObserver(this); | 55 message_loop_->AddDestructionObserver(this); |
55 | 56 |
56 WrapCurrent(); | 57 WrapCurrent(); |
57 } | 58 } |
58 | 59 |
59 JingleThreadWrapper::~JingleThreadWrapper() { | 60 JingleThreadWrapper::~JingleThreadWrapper() { |
60 } | 61 } |
61 | 62 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 288 |
288 void JingleThreadWrapper::Stop() { | 289 void JingleThreadWrapper::Stop() { |
289 NOTREACHED(); | 290 NOTREACHED(); |
290 } | 291 } |
291 | 292 |
292 void JingleThreadWrapper::Run() { | 293 void JingleThreadWrapper::Run() { |
293 NOTREACHED(); | 294 NOTREACHED(); |
294 } | 295 } |
295 | 296 |
296 } // namespace jingle_glue | 297 } // namespace jingle_glue |
OLD | NEW |