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

Unified Diff: webrtc/base/timeutils.h

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: Fixing another TSan warning. WebRtcSession wasn't completely shut down. Created 4 years, 6 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/timeutils.h
diff --git a/webrtc/base/timeutils.h b/webrtc/base/timeutils.h
index 78ebacee38df5087737de039fa20a6e8c485c9f6..113793ade3c81567a317ad7a3669bc08d3aa72c9 100644
--- a/webrtc/base/timeutils.h
+++ b/webrtc/base/timeutils.h
@@ -39,8 +39,10 @@ class ClockInterface {
// Sets the global source of time. This is useful mainly for unit tests.
//
-// Does not transfer ownership of the clock.
-// SetClock(nullptr) should be called before the ClockInterface is deleted.
+// Returns the previously set ClockInterface, or nullptr if none is set.
+//
+// Does not transfer ownership of the clock. SetClockForTesting(nullptr)
+// should be called before the ClockInterface is deleted.
//
// This method is not thread-safe; it should only be used when no other thread
// is running (for example, at the start/end of a unit test, or start/end of
@@ -49,7 +51,7 @@ class ClockInterface {
// TODO(deadbeef): Instead of having functions that access this global
nisse-webrtc 2016/06/08 09:47:30 I don't think it's a good idea to pass around the
// ClockInterface, we may want to pass the ClockInterface into everything
// that uses it, eliminating the need for a global variable and this function.
-void SetClock(ClockInterface* clock);
+ClockInterface* SetClockForTesting(ClockInterface* clock);
// Returns the current time in milliseconds in 32 bits.
uint32_t Time32();

Powered by Google App Engine
This is Rietveld 408576698