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

Unified Diff: base/time.h

Issue 11453012: Fix black background when locking with fullscreen window: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rename undo/stop to cancel Created 8 years 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: base/time.h
diff --git a/base/time.h b/base/time.h
index 78d7456b68ae273c3bf27e8aaf93cd3742efe02c..e2aeacede779c7e89d2a986c6007ac07e8efbabc 100644
--- a/base/time.h
+++ b/base/time.h
@@ -17,6 +17,9 @@
// Time::Now() may actually decrease or jump). But note that TimeTicks may
// "stand still", for example if the computer suspended.
//
+// TimeFactory can be used to override values returned by Time::Now and
+// TimeTicks::Now for test purposes.
+//
// These classes are represented as only a 64-bit value, so they can be
// efficiently passed by value.
@@ -638,6 +641,25 @@ inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
return TimeTicks(t.ticks_ + delta_);
}
+// TimeFactory ----------------------------------------------------------------
+
+// This class should be subclassed to provide test values for Time::Now and
+// TimeTicks::Now. Subclass instance should register itself by setting
+// |instance_| fields.
+class BASE_EXPORT TimeFactory {
+ public:
+ // Substitutes value for Time::Now().
+ virtual Time TimeNow() = 0;
+ // Substitutes value for TimeTicks::Now()
+ virtual TimeTicks TimeTicksNow() = 0;
+
+ // Returns instance of |TimeFactory|. If null, system time routines are used.
+ static TimeFactory* instance() { return instance_; }
+ protected:
+ // Implementation of TimeFactory (set by implementing subclasses).
+ static TimeFactory* instance_;
+};
+
} // namespace base
#endif // BASE_TIME_H_

Powered by Google App Engine
This is Rietveld 408576698