Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: webrtc/base/asyncinvoker.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698