| OLD | NEW |
| 1 // Copyright (c) 2012 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 #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" |
| 11 | 11 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 if (delay_ms <= 0) { | 210 if (delay_ms <= 0) { |
| 211 message_loop_->PostTask(FROM_HERE, | 211 message_loop_->PostTask(FROM_HERE, |
| 212 base::Bind(&JingleThreadWrapper::RunTask, | 212 base::Bind(&JingleThreadWrapper::RunTask, |
| 213 base::Unretained(this), task_id)); | 213 base::Unretained(this), task_id)); |
| 214 } else { | 214 } else { |
| 215 message_loop_->PostDelayedTask(FROM_HERE, | 215 message_loop_->PostDelayedTask(FROM_HERE, |
| 216 base::Bind(&JingleThreadWrapper::RunTask, | 216 base::Bind(&JingleThreadWrapper::RunTask, |
| 217 base::Unretained(this), task_id), | 217 base::Unretained(this), task_id), |
| 218 base::TimeDelta::FromMilliseconds(delay_ms)); | 218 delay_ms); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 void JingleThreadWrapper::RunTask(int task_id) { | 222 void JingleThreadWrapper::RunTask(int task_id) { |
| 223 bool have_message = false; | 223 bool have_message = false; |
| 224 talk_base::Message message; | 224 talk_base::Message message; |
| 225 { | 225 { |
| 226 base::AutoLock auto_lock(lock_); | 226 base::AutoLock auto_lock(lock_); |
| 227 MessagesQueue::iterator it = messages_.find(task_id); | 227 MessagesQueue::iterator it = messages_.find(task_id); |
| 228 if (it != messages_.end()) { | 228 if (it != messages_.end()) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 void JingleThreadWrapper::Stop() { | 288 void JingleThreadWrapper::Stop() { |
| 289 NOTREACHED(); | 289 NOTREACHED(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void JingleThreadWrapper::Run() { | 292 void JingleThreadWrapper::Run() { |
| 293 NOTREACHED(); | 293 NOTREACHED(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace jingle_glue | 296 } // namespace jingle_glue |
| OLD | NEW |