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

Side by Side Diff: webrtc/base/messagequeue.h

Issue 2718663005: Replace NULL with nullptr or null in webrtc/base/. (Closed)
Patch Set: Fixing Windows and formatting issues. Created 3 years, 9 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
« no previous file with comments | « webrtc/base/messagedigest.cc ('k') | webrtc/base/messagequeue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 const uint32_t MQID_ANY = static_cast<uint32_t>(-1); 151 const uint32_t MQID_ANY = static_cast<uint32_t>(-1);
152 const uint32_t MQID_DISPOSE = static_cast<uint32_t>(-2); 152 const uint32_t MQID_DISPOSE = static_cast<uint32_t>(-2);
153 153
154 // No destructor 154 // No destructor
155 155
156 struct Message { 156 struct Message {
157 Message() 157 Message()
158 : phandler(nullptr), message_id(0), pdata(nullptr), ts_sensitive(0) {} 158 : phandler(nullptr), message_id(0), pdata(nullptr), ts_sensitive(0) {}
159 inline bool Match(MessageHandler* handler, uint32_t id) const { 159 inline bool Match(MessageHandler* handler, uint32_t id) const {
160 return (handler == NULL || handler == phandler) 160 return (handler == nullptr || handler == phandler) &&
161 && (id == MQID_ANY || id == message_id); 161 (id == MQID_ANY || id == message_id);
162 } 162 }
163 Location posted_from; 163 Location posted_from;
164 MessageHandler *phandler; 164 MessageHandler *phandler;
165 uint32_t message_id; 165 uint32_t message_id;
166 MessageData *pdata; 166 MessageData *pdata;
167 int64_t ts_sensitive; 167 int64_t ts_sensitive;
168 }; 168 };
169 169
170 typedef std::list<Message> MessageList; 170 typedef std::list<Message> MessageList;
171 171
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Get() will process I/O until: 229 // Get() will process I/O until:
230 // 1) A message is available (returns true) 230 // 1) A message is available (returns true)
231 // 2) cmsWait seconds have elapsed (returns false) 231 // 2) cmsWait seconds have elapsed (returns false)
232 // 3) Stop() is called (returns false) 232 // 3) Stop() is called (returns false)
233 virtual bool Get(Message *pmsg, int cmsWait = kForever, 233 virtual bool Get(Message *pmsg, int cmsWait = kForever,
234 bool process_io = true); 234 bool process_io = true);
235 virtual bool Peek(Message *pmsg, int cmsWait = 0); 235 virtual bool Peek(Message *pmsg, int cmsWait = 0);
236 virtual void Post(const Location& posted_from, 236 virtual void Post(const Location& posted_from,
237 MessageHandler* phandler, 237 MessageHandler* phandler,
238 uint32_t id = 0, 238 uint32_t id = 0,
239 MessageData* pdata = NULL, 239 MessageData* pdata = nullptr,
240 bool time_sensitive = false); 240 bool time_sensitive = false);
241 virtual void PostDelayed(const Location& posted_from, 241 virtual void PostDelayed(const Location& posted_from,
242 int cmsDelay, 242 int cmsDelay,
243 MessageHandler* phandler, 243 MessageHandler* phandler,
244 uint32_t id = 0, 244 uint32_t id = 0,
245 MessageData* pdata = NULL); 245 MessageData* pdata = nullptr);
246 virtual void PostAt(const Location& posted_from, 246 virtual void PostAt(const Location& posted_from,
247 int64_t tstamp, 247 int64_t tstamp,
248 MessageHandler* phandler, 248 MessageHandler* phandler,
249 uint32_t id = 0, 249 uint32_t id = 0,
250 MessageData* pdata = NULL); 250 MessageData* pdata = nullptr);
251 // TODO(honghaiz): Remove this when all the dependencies are removed. 251 // TODO(honghaiz): Remove this when all the dependencies are removed.
252 virtual void PostAt(const Location& posted_from, 252 virtual void PostAt(const Location& posted_from,
253 uint32_t tstamp, 253 uint32_t tstamp,
254 MessageHandler* phandler, 254 MessageHandler* phandler,
255 uint32_t id = 0, 255 uint32_t id = 0,
256 MessageData* pdata = NULL); 256 MessageData* pdata = nullptr);
257 virtual void Clear(MessageHandler* phandler, 257 virtual void Clear(MessageHandler* phandler,
258 uint32_t id = MQID_ANY, 258 uint32_t id = MQID_ANY,
259 MessageList* removed = NULL); 259 MessageList* removed = nullptr);
260 virtual void Dispatch(Message *pmsg); 260 virtual void Dispatch(Message *pmsg);
261 virtual void ReceiveSends(); 261 virtual void ReceiveSends();
262 262
263 // Amount of time until the next message can be retrieved 263 // Amount of time until the next message can be retrieved
264 virtual int GetDelay(); 264 virtual int GetDelay();
265 265
266 bool empty() const { return size() == 0u; } 266 bool empty() const { return size() == 0u; }
267 size_t size() const { 267 size_t size() const {
268 CritScope cs(&crit_); // msgq_.size() is not thread safe. 268 CritScope cs(&crit_); // msgq_.size() is not thread safe.
269 return msgq_.size() + dmsgq_.size() + (fPeekKeep_ ? 1u : 0u); 269 return msgq_.size() + dmsgq_.size() + (fPeekKeep_ ? 1u : 0u);
270 } 270 }
271 271
272 // Internally posts a message which causes the doomed object to be deleted 272 // Internally posts a message which causes the doomed object to be deleted
273 template<class T> void Dispose(T* doomed) { 273 template<class T> void Dispose(T* doomed) {
274 if (doomed) { 274 if (doomed) {
275 Post(RTC_FROM_HERE, NULL, MQID_DISPOSE, new DisposeData<T>(doomed)); 275 Post(RTC_FROM_HERE, nullptr, MQID_DISPOSE, new DisposeData<T>(doomed));
276 } 276 }
277 } 277 }
278 278
279 // When this signal is sent out, any references to this queue should 279 // When this signal is sent out, any references to this queue should
280 // no longer be used. 280 // no longer be used.
281 sigslot::signal0<> SignalQueueDestroyed; 281 sigslot::signal0<> SignalQueueDestroyed;
282 282
283 protected: 283 protected:
284 class PriorityQueue : public std::priority_queue<DelayedMessage> { 284 class PriorityQueue : public std::priority_queue<DelayedMessage> {
285 public: 285 public:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // Used if SocketServer ownership lies with |this|. 321 // Used if SocketServer ownership lies with |this|.
322 std::unique_ptr<SocketServer> own_ss_; 322 std::unique_ptr<SocketServer> own_ss_;
323 SharedExclusiveLock ss_lock_; 323 SharedExclusiveLock ss_lock_;
324 324
325 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); 325 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue);
326 }; 326 };
327 327
328 } // namespace rtc 328 } // namespace rtc
329 329
330 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ 330 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_
OLDNEW
« no previous file with comments | « webrtc/base/messagedigest.cc ('k') | webrtc/base/messagequeue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698