 Chromium Code Reviews
 Chromium Code Reviews Issue 2828223002:
  Delete method MessageQueue::set_socketserver  (Closed)
    
  
    Issue 2828223002:
  Delete method MessageQueue::set_socketserver  (Closed) 
  | Index: webrtc/base/messagequeue.cc | 
| diff --git a/webrtc/base/messagequeue.cc b/webrtc/base/messagequeue.cc | 
| index efe618851a82086c5450dd3096684ee04477ee58..7622ef2d8efb7974282ddc9f5f049053d9dee9c0 100644 | 
| --- a/webrtc/base/messagequeue.cc | 
| +++ b/webrtc/base/messagequeue.cc | 
| @@ -146,8 +146,8 @@ void MessageQueueManager::ProcessAllMessageQueuesInternal() { | 
| { | 
| DebugNonReentrantCritScope cs(&crit_, &locked_); | 
| for (MessageQueue* queue : message_queues_) { | 
| - if (!queue->IsProcessingMessages()) { | 
| - // If the queue is not processing messages, it can | 
| + if (!queue->IsProcessingMessages() || queue->empty()) { | 
| 
Taylor Brandstetter
2017/04/28 02:59:34
Is the "|| queue->empty()" part still needed?
 
nisse-webrtc
2017/04/28 09:46:52
Unfortunately yes. Otherwise, rtc_unittests hangs
 | 
| + // If the queue is empty or not processing messages, it can | 
| // be ignored. If we tried to post a message to it, it would be dropped | 
| // or ignored. | 
| continue; | 
| @@ -216,30 +216,16 @@ void MessageQueue::DoDestroy() { | 
| MessageQueueManager::Remove(this); | 
| Clear(nullptr); | 
| - SharedScope ss(&ss_lock_); | 
| if (ss_) { | 
| ss_->SetMessageQueue(nullptr); | 
| } | 
| } | 
| SocketServer* MessageQueue::socketserver() { | 
| - SharedScope ss(&ss_lock_); | 
| return ss_; | 
| } | 
| -void MessageQueue::set_socketserver(SocketServer* ss) { | 
| - // Need to lock exclusively here to prevent simultaneous modifications from | 
| - // other threads. Can't be a shared lock to prevent races with other reading | 
| - // threads. | 
| - // Other places that only read "ss_" can use a shared lock as simultaneous | 
| - // read access is allowed. | 
| - ExclusiveScope es(&ss_lock_); | 
| - ss_ = ss ? ss : own_ss_.get(); | 
| - ss_->SetMessageQueue(this); | 
| -} | 
| - | 
| void MessageQueue::WakeUpSocketServer() { | 
| - SharedScope ss(&ss_lock_); | 
| ss_->WakeUp(); | 
| } | 
| @@ -357,7 +343,6 @@ bool MessageQueue::Get(Message *pmsg, int cmsWait, bool process_io) { | 
| { | 
| // Wait and multiplex in the meantime | 
| - SharedScope ss(&ss_lock_); | 
| if (!ss_->Wait(static_cast<int>(cmsNext), process_io)) | 
| return false; | 
| } |