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 12 matching lines...) Expand all Loading... |
23 // Messages for this need to be cleared *before* our destructor is complete. | 23 // Messages for this need to be cleared *before* our destructor is complete. |
24 MessageQueueManager::Clear(this); | 24 MessageQueueManager::Clear(this); |
25 } | 25 } |
26 | 26 |
27 void AsyncInvoker::OnMessage(Message* msg) { | 27 void AsyncInvoker::OnMessage(Message* msg) { |
28 // Get the AsyncClosure shared ptr from this message's data. | 28 // Get the AsyncClosure shared ptr from this message's data. |
29 ScopedRefMessageData<AsyncClosure>* data = | 29 ScopedRefMessageData<AsyncClosure>* data = |
30 static_cast<ScopedRefMessageData<AsyncClosure>*>(msg->pdata); | 30 static_cast<ScopedRefMessageData<AsyncClosure>*>(msg->pdata); |
31 scoped_refptr<AsyncClosure> closure = data->data(); | 31 scoped_refptr<AsyncClosure> closure = data->data(); |
32 delete msg->pdata; | 32 delete msg->pdata; |
33 msg->pdata = NULL; | 33 msg->pdata = nullptr; |
34 | 34 |
35 // Execute the closure and trigger the return message if needed. | 35 // Execute the closure and trigger the return message if needed. |
36 closure->Execute(); | 36 closure->Execute(); |
37 } | 37 } |
38 | 38 |
39 void AsyncInvoker::Flush(Thread* thread, uint32_t id /*= MQID_ANY*/) { | 39 void AsyncInvoker::Flush(Thread* thread, uint32_t id /*= MQID_ANY*/) { |
40 if (destroying_) return; | 40 if (destroying_) return; |
41 | 41 |
42 // Run this on |thread| to reduce the number of context switches. | 42 // Run this on |thread| to reduce the number of context switches. |
43 if (Thread::Current() != thread) { | 43 if (Thread::Current() != thread) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 invoker_->AsyncInvoke<void>(callback_posted_from_, calling_thread_, | 125 invoker_->AsyncInvoke<void>(callback_posted_from_, calling_thread_, |
126 callback_); | 126 callback_); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 void NotifyingAsyncClosureBase::CancelCallback() { | 130 void NotifyingAsyncClosureBase::CancelCallback() { |
131 // If the callback is triggering when this is called, block the | 131 // If the callback is triggering when this is called, block the |
132 // destructor of the dying object here by waiting until the callback | 132 // destructor of the dying object here by waiting until the callback |
133 // is done triggering. | 133 // is done triggering. |
134 CritScope cs(&crit_); | 134 CritScope cs(&crit_); |
135 // calling_thread_ == NULL means do not trigger the callback. | 135 // calling_thread_ == null means do not trigger the callback. |
136 calling_thread_ = NULL; | 136 calling_thread_ = nullptr; |
137 } | 137 } |
138 | 138 |
139 } // namespace rtc | 139 } // namespace rtc |
OLD | NEW |