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