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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 ++iter; | 464 ++iter; |
465 } | 465 } |
466 | 466 |
467 MessageQueue::Clear(phandler, id, removed); | 467 MessageQueue::Clear(phandler, id, removed); |
468 } | 468 } |
469 | 469 |
470 #if !defined(WEBRTC_MAC) | 470 #if !defined(WEBRTC_MAC) |
471 // Note that these methods have a separate implementation for mac and ios | 471 // Note that these methods have a separate implementation for mac and ios |
472 // defined in webrtc/base/thread_darwin.mm. | 472 // defined in webrtc/base/thread_darwin.mm. |
473 bool Thread::ProcessMessages(int cmsLoop) { | 473 bool Thread::ProcessMessages(int cmsLoop) { |
| 474 // Using ProcessMessages with a custom clock for testing and a time greater |
| 475 // than 0 doesn't work, since it's not guaranteed to advance the custom |
| 476 // clock's time, and may get stuck in an infinite loop. |
| 477 RTC_DCHECK(GetClockForTesting() == nullptr || cmsLoop == 0 || |
| 478 cmsLoop == kForever); |
474 int64_t msEnd = (kForever == cmsLoop) ? 0 : TimeAfter(cmsLoop); | 479 int64_t msEnd = (kForever == cmsLoop) ? 0 : TimeAfter(cmsLoop); |
475 int cmsNext = cmsLoop; | 480 int cmsNext = cmsLoop; |
476 | 481 |
477 while (true) { | 482 while (true) { |
478 Message msg; | 483 Message msg; |
479 if (!Get(&msg, cmsNext)) | 484 if (!Get(&msg, cmsNext)) |
480 return !IsQuitting(); | 485 return !IsQuitting(); |
481 Dispatch(&msg); | 486 Dispatch(&msg); |
482 | 487 |
483 if (cmsLoop != kForever) { | 488 if (cmsLoop != kForever) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 // P2PTransportChannelPingTest, relying on the message posted in | 549 // P2PTransportChannelPingTest, relying on the message posted in |
545 // cricket::Connection::Destroy. | 550 // cricket::Connection::Destroy. |
546 ProcessMessages(0); | 551 ProcessMessages(0); |
547 rtc::ThreadManager::Instance()->SetCurrentThread(old_thread_); | 552 rtc::ThreadManager::Instance()->SetCurrentThread(old_thread_); |
548 if (old_thread_) { | 553 if (old_thread_) { |
549 MessageQueueManager::Add(old_thread_); | 554 MessageQueueManager::Add(old_thread_); |
550 } | 555 } |
551 } | 556 } |
552 | 557 |
553 } // namespace rtc | 558 } // namespace rtc |
OLD | NEW |