Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Unified Diff: webrtc/base/fakeclock.cc

Issue 2024813004: Improving the fake clock and using it to fix a flaky STUN timeout test. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Revising comments etc. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/base/fakeclock.cc
diff --git a/webrtc/base/fakeclock.cc b/webrtc/base/fakeclock.cc
index e5aa3bc0a4fc3af0aecd8e58b395c54ce48f0d41..e3ea8d3334a3ee8c08aa21026cef91194197cfed 100644
--- a/webrtc/base/fakeclock.cc
+++ b/webrtc/base/fakeclock.cc
@@ -27,14 +27,16 @@ void FakeClock::SetTimeNanos(uint64_t nanos) {
time_ = nanos;
}
// If message queues are waiting in a socket select() with a timeout provided
- // by the OS, they should wake up to check if there are any messages ready to
- // be dispatched based on the fake time.
- MessageQueueManager::WakeAllMessageQueues();
+ // by the OS, they should wake up and dispatch all messages that are ready.
+ MessageQueueManager::ProcessAllMessageQueues();
}
void FakeClock::AdvanceTime(TimeDelta delta) {
- CritScope cs(&lock_);
- SetTimeNanos(time_ + delta.ToNanoseconds());
+ {
+ CritScope cs(&lock_);
+ time_ += delta.ToNanoseconds();
+ }
+ MessageQueueManager::ProcessAllMessageQueues();
}
} // namespace rtc

Powered by Google App Engine
This is Rietveld 408576698