| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // Falling behind, we should call the callback now. | 29 // Falling behind, we should call the callback now. |
| 30 return time_now; | 30 return time_now; |
| 31 } | 31 } |
| 32 return time_now + interval; | 32 return time_now + interval; |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 ProcessThread::~ProcessThread() {} | 36 ProcessThread::~ProcessThread() {} |
| 37 | 37 |
| 38 // static | 38 // static |
| 39 rtc::scoped_ptr<ProcessThread> ProcessThread::Create( | 39 std::unique_ptr<ProcessThread> ProcessThread::Create( |
| 40 const char* thread_name) { | 40 const char* thread_name) { |
| 41 return rtc::scoped_ptr<ProcessThread>(new ProcessThreadImpl(thread_name)); | 41 return std::unique_ptr<ProcessThread>(new ProcessThreadImpl(thread_name)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 ProcessThreadImpl::ProcessThreadImpl(const char* thread_name) | 44 ProcessThreadImpl::ProcessThreadImpl(const char* thread_name) |
| 45 : wake_up_(EventWrapper::Create()), | 45 : wake_up_(EventWrapper::Create()), |
| 46 stop_(false), | 46 stop_(false), |
| 47 thread_name_(thread_name) {} | 47 thread_name_(thread_name) {} |
| 48 | 48 |
| 49 ProcessThreadImpl::~ProcessThreadImpl() { | 49 ProcessThreadImpl::~ProcessThreadImpl() { |
| 50 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 50 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 51 RTC_DCHECK(!thread_.get()); | 51 RTC_DCHECK(!thread_.get()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 { | 112 { |
| 113 rtc::CritScope lock(&lock_); | 113 rtc::CritScope lock(&lock_); |
| 114 for (ModuleCallback& m : modules_) { | 114 for (ModuleCallback& m : modules_) { |
| 115 if (m.module == module) | 115 if (m.module == module) |
| 116 m.next_callback = kCallProcessImmediately; | 116 m.next_callback = kCallProcessImmediately; |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 wake_up_->Set(); | 119 wake_up_->Set(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void ProcessThreadImpl::PostTask(rtc::scoped_ptr<ProcessTask> task) { | 122 void ProcessThreadImpl::PostTask(std::unique_ptr<ProcessTask> task) { |
| 123 // Allowed to be called on any thread. | 123 // Allowed to be called on any thread. |
| 124 { | 124 { |
| 125 rtc::CritScope lock(&lock_); | 125 rtc::CritScope lock(&lock_); |
| 126 queue_.push(task.release()); | 126 queue_.push(task.release()); |
| 127 } | 127 } |
| 128 wake_up_->Set(); | 128 wake_up_->Set(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void ProcessThreadImpl::RegisterModule(Module* module) { | 131 void ProcessThreadImpl::RegisterModule(Module* module) { |
| 132 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 132 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 int64_t time_to_wait = next_checkpoint - TickTime::MillisecondTimestamp(); | 230 int64_t time_to_wait = next_checkpoint - TickTime::MillisecondTimestamp(); |
| 231 if (time_to_wait > 0) | 231 if (time_to_wait > 0) |
| 232 wake_up_->Wait(static_cast<unsigned long>(time_to_wait)); | 232 wake_up_->Wait(static_cast<unsigned long>(time_to_wait)); |
| 233 | 233 |
| 234 return true; | 234 return true; |
| 235 } | 235 } |
| 236 } // namespace webrtc | 236 } // namespace webrtc |
| OLD | NEW |