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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 : rtc::Thread(new rtc::NullSocketServer()), | 50 : rtc::Thread(new rtc::NullSocketServer()), |
51 task_runner_(task_runner), | 51 task_runner_(task_runner), |
52 send_allowed_(false), | 52 send_allowed_(false), |
53 last_task_id_(0), | 53 last_task_id_(0), |
54 pending_send_event_(true, false), | 54 pending_send_event_(true, false), |
55 weak_ptr_factory_(this) { | 55 weak_ptr_factory_(this) { |
56 DCHECK(task_runner->BelongsToCurrentThread()); | 56 DCHECK(task_runner->BelongsToCurrentThread()); |
57 DCHECK(!rtc::Thread::Current()); | 57 DCHECK(!rtc::Thread::Current()); |
58 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); | 58 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); |
59 rtc::MessageQueueManager::Add(this); | 59 rtc::MessageQueueManager::Add(this); |
60 CHECK(WrapCurrent()); | 60 SafeWrapCurrent(); |
61 } | 61 } |
62 | 62 |
63 JingleThreadWrapper::~JingleThreadWrapper() { | 63 JingleThreadWrapper::~JingleThreadWrapper() { |
64 Clear(NULL, rtc::MQID_ANY, NULL); | 64 Clear(NULL, rtc::MQID_ANY, NULL); |
65 } | 65 } |
66 | 66 |
67 void JingleThreadWrapper::WillDestroyCurrentMessageLoop() { | 67 void JingleThreadWrapper::WillDestroyCurrentMessageLoop() { |
68 DCHECK_EQ(rtc::Thread::Current(), current()); | 68 DCHECK_EQ(rtc::Thread::Current(), current()); |
69 UnwrapCurrent(); | 69 UnwrapCurrent(); |
70 g_jingle_thread_wrapper.Get().Set(NULL); | 70 g_jingle_thread_wrapper.Get().Set(NULL); |
(...skipping 222 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 |