OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/jingle_glue/jingle_thread.h" | 5 #include "remoting/jingle_glue/jingle_thread.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_pump.h" | 9 #include "base/message_pump.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // Returns task pump if the thread is running, otherwise NULL is returned. | 156 // Returns task pump if the thread is running, otherwise NULL is returned. |
157 TaskPump* JingleThread::task_pump() { | 157 TaskPump* JingleThread::task_pump() { |
158 return task_pump_; | 158 return task_pump_; |
159 } | 159 } |
160 | 160 |
161 void JingleThread::OnMessage(talk_base::Message* msg) { | 161 void JingleThread::OnMessage(talk_base::Message* msg) { |
162 DCHECK(msg->message_id == kStopMessageId); | 162 DCHECK(msg->message_id == kStopMessageId); |
163 | 163 |
164 // Stop the thread only if there are no more messages left in the queue, | 164 // Stop the thread only if there are no more messages left in the queue, |
165 // otherwise post another task to try again later. | 165 // otherwise post another task to try again later. |
166 if (msgq_.size() > 0 || fPeekKeep_) { | 166 if (!msgq_.empty() || fPeekKeep_) { |
167 Post(this, kStopMessageId); | 167 Post(this, kStopMessageId); |
168 } else { | 168 } else { |
169 MessageQueue::Quit(); | 169 MessageQueue::Quit(); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 } // namespace remoting | 173 } // namespace remoting |
OLD | NEW |