Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 | 202 |
| 203 // Note: The behavior of MessageQueue has changed. When a MQ is stopped, | 203 // Note: The behavior of MessageQueue has changed. When a MQ is stopped, |
| 204 // futher Posts and Sends will fail. However, any pending Sends and *ready* | 204 // futher Posts and Sends will fail. However, any pending Sends and *ready* |
| 205 // Posts (as opposed to unexpired delayed Posts) will be delivered before | 205 // Posts (as opposed to unexpired delayed Posts) will be delivered before |
| 206 // Get (or Peek) returns false. By guaranteeing delivery of those messages, | 206 // Get (or Peek) returns false. By guaranteeing delivery of those messages, |
| 207 // we eliminate the race condition when an MessageHandler and MessageQueue | 207 // we eliminate the race condition when an MessageHandler and MessageQueue |
| 208 // may be destroyed independently of each other. | 208 // may be destroyed independently of each other. |
| 209 virtual void Quit(); | 209 virtual void Quit(); |
| 210 virtual bool IsQuitting(); | 210 virtual bool IsQuitting(); |
| 211 virtual void Restart(); | 211 virtual void Restart(); |
| 212 // If true, MessageQueueManager::ProcessAllMessageQueues will wait | |
| 213 // for the messages to be processed. Otherwise, it will skip this | |
| 214 // message queue and not wait for it. We need this because some | |
| 215 // subclasses of Thread don't process messsages and break | |
| 216 // ProcessAllMessagesQueues. Those threads needs to set this to | |
| 217 // false. | |
|
Taylor Brandstetter
2017/02/06 19:23:43
I'd suggest moving this comment to the CC file.
| |
| 218 virtual bool WaitForProcess(); | |
|
Taylor Brandstetter
2017/02/06 19:23:42
I'd suggest renaming this to "IsProcessingMessages
| |
| 212 | 219 |
| 213 // Get() will process I/O until: | 220 // Get() will process I/O until: |
| 214 // 1) A message is available (returns true) | 221 // 1) A message is available (returns true) |
| 215 // 2) cmsWait seconds have elapsed (returns false) | 222 // 2) cmsWait seconds have elapsed (returns false) |
| 216 // 3) Stop() is called (returns false) | 223 // 3) Stop() is called (returns false) |
| 217 virtual bool Get(Message *pmsg, int cmsWait = kForever, | 224 virtual bool Get(Message *pmsg, int cmsWait = kForever, |
| 218 bool process_io = true); | 225 bool process_io = true); |
| 219 virtual bool Peek(Message *pmsg, int cmsWait = 0); | 226 virtual bool Peek(Message *pmsg, int cmsWait = 0); |
| 220 virtual void Post(const Location& posted_from, | 227 virtual void Post(const Location& posted_from, |
| 221 MessageHandler* phandler, | 228 MessageHandler* phandler, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 // Used if SocketServer ownership lies with |this|. | 312 // Used if SocketServer ownership lies with |this|. |
| 306 std::unique_ptr<SocketServer> own_ss_; | 313 std::unique_ptr<SocketServer> own_ss_; |
| 307 SharedExclusiveLock ss_lock_; | 314 SharedExclusiveLock ss_lock_; |
| 308 | 315 |
| 309 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); | 316 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); |
| 310 }; | 317 }; |
| 311 | 318 |
| 312 } // namespace rtc | 319 } // namespace rtc |
| 313 | 320 |
| 314 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ | 321 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ |
| OLD | NEW |