| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 rtc::CritScope cs(&crit_); | 89 rtc::CritScope cs(&crit_); |
| 90 if (thread_ == nullptr) | 90 if (thread_ == nullptr) |
| 91 return false; | 91 return false; |
| 92 invoker_.Flush(thread_, id); | 92 invoker_.Flush(thread_, id); |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void GuardedAsyncInvoker::ThreadDestroyed() { | 96 void GuardedAsyncInvoker::ThreadDestroyed() { |
| 97 rtc::CritScope cs(&crit_); | 97 rtc::CritScope cs(&crit_); |
| 98 // We should never get more than one notification about the thread dying. | 98 // We should never get more than one notification about the thread dying. |
| 99 DCHECK(thread_ != nullptr); | 99 RTC_DCHECK(thread_ != nullptr); |
| 100 thread_ = nullptr; | 100 thread_ = nullptr; |
| 101 } | 101 } |
| 102 | 102 |
| 103 NotifyingAsyncClosureBase::NotifyingAsyncClosureBase(AsyncInvoker* invoker, | 103 NotifyingAsyncClosureBase::NotifyingAsyncClosureBase(AsyncInvoker* invoker, |
| 104 Thread* calling_thread) | 104 Thread* calling_thread) |
| 105 : invoker_(invoker), calling_thread_(calling_thread) { | 105 : invoker_(invoker), calling_thread_(calling_thread) { |
| 106 calling_thread->SignalQueueDestroyed.connect( | 106 calling_thread->SignalQueueDestroyed.connect( |
| 107 this, &NotifyingAsyncClosureBase::CancelCallback); | 107 this, &NotifyingAsyncClosureBase::CancelCallback); |
| 108 invoker->SignalInvokerDestroyed.connect( | 108 invoker->SignalInvokerDestroyed.connect( |
| 109 this, &NotifyingAsyncClosureBase::CancelCallback); | 109 this, &NotifyingAsyncClosureBase::CancelCallback); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 123 void NotifyingAsyncClosureBase::CancelCallback() { | 123 void NotifyingAsyncClosureBase::CancelCallback() { |
| 124 // If the callback is triggering when this is called, block the | 124 // If the callback is triggering when this is called, block the |
| 125 // destructor of the dying object here by waiting until the callback | 125 // destructor of the dying object here by waiting until the callback |
| 126 // is done triggering. | 126 // is done triggering. |
| 127 CritScope cs(&crit_); | 127 CritScope cs(&crit_); |
| 128 // calling_thread_ == NULL means do not trigger the callback. | 128 // calling_thread_ == NULL means do not trigger the callback. |
| 129 calling_thread_ = NULL; | 129 calling_thread_ = NULL; |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace rtc | 132 } // namespace rtc |
| OLD | NEW |