OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 221 } |
222 }); | 222 }); |
223 } | 223 } |
224 | 224 |
225 void TaskQueue::PostTaskAndReply(std::unique_ptr<QueuedTask> task, | 225 void TaskQueue::PostTaskAndReply(std::unique_ptr<QueuedTask> task, |
226 std::unique_ptr<QueuedTask> reply) { | 226 std::unique_ptr<QueuedTask> reply) { |
227 return PostTaskAndReply(std::move(task), std::move(reply), Current()); | 227 return PostTaskAndReply(std::move(task), std::move(reply), Current()); |
228 } | 228 } |
229 | 229 |
230 // static | 230 // static |
231 bool TaskQueue::ThreadMain(void* context) { | 231 void TaskQueue::ThreadMain(void* context) { |
232 HANDLE timer_handles[MultimediaTimer::kMaxTimers]; | 232 HANDLE timer_handles[MultimediaTimer::kMaxTimers]; |
233 // Active multimedia timers. | 233 // Active multimedia timers. |
234 std::vector<MultimediaTimer> mm_timers; | 234 std::vector<MultimediaTimer> mm_timers; |
235 // Tasks that have been queued by using SetTimer/WM_TIMER. | 235 // Tasks that have been queued by using SetTimer/WM_TIMER. |
236 DelayedTasks delayed_tasks; | 236 DelayedTasks delayed_tasks; |
237 | 237 |
238 while (true) { | 238 while (true) { |
239 RTC_DCHECK(mm_timers.size() <= arraysize(timer_handles)); | 239 RTC_DCHECK(mm_timers.size() <= arraysize(timer_handles)); |
240 DWORD count = 0; | 240 DWORD count = 0; |
241 for (const auto& t : mm_timers) { | 241 for (const auto& t : mm_timers) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 if (inactive != mm_timers.end()) { | 276 if (inactive != mm_timers.end()) { |
277 // Since inactive timers are always moved to the back, we can | 277 // Since inactive timers are always moved to the back, we can |
278 // safely delete all timers following the first inactive one. | 278 // safely delete all timers following the first inactive one. |
279 mm_timers.erase(inactive, mm_timers.end()); | 279 mm_timers.erase(inactive, mm_timers.end()); |
280 } | 280 } |
281 } | 281 } |
282 } else { | 282 } else { |
283 RTC_DCHECK_EQ(WAIT_IO_COMPLETION, result); | 283 RTC_DCHECK_EQ(WAIT_IO_COMPLETION, result); |
284 } | 284 } |
285 } | 285 } |
286 | |
287 return false; | |
288 } | 286 } |
289 | 287 |
290 // static | 288 // static |
291 bool TaskQueue::ProcessQueuedMessages(DelayedTasks* delayed_tasks, | 289 bool TaskQueue::ProcessQueuedMessages(DelayedTasks* delayed_tasks, |
292 std::vector<MultimediaTimer>* timers) { | 290 std::vector<MultimediaTimer>* timers) { |
293 MSG msg = {}; | 291 MSG msg = {}; |
294 while (::PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE) && | 292 while (::PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE) && |
295 msg.message != WM_QUIT) { | 293 msg.message != WM_QUIT) { |
296 if (!msg.hwnd) { | 294 if (!msg.hwnd) { |
297 switch (msg.message) { | 295 switch (msg.message) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 355 } |
358 } else { | 356 } else { |
359 ::TranslateMessage(&msg); | 357 ::TranslateMessage(&msg); |
360 ::DispatchMessage(&msg); | 358 ::DispatchMessage(&msg); |
361 } | 359 } |
362 } | 360 } |
363 return msg.message != WM_QUIT; | 361 return msg.message != WM_QUIT; |
364 } | 362 } |
365 | 363 |
366 } // namespace rtc | 364 } // namespace rtc |
OLD | NEW |