Bug 952893. Part 3: Tighten TimeVarying invariants so that GetAt always returns an end time when the value actually changes. r=padenot

This commit is contained in:
Robert O'Callahan 2014-01-16 00:13:08 +13:00
Родитель 1161223f59
Коммит cd547c4bb4
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -44,6 +44,9 @@ protected:
* The implementation records a mCurrent (the value at the current time)
* and an array of "change times" (greater than the current time) and the
* new value for each change time. This is a simple but dumb implementation.
* We maintain the invariant that each change entry in the array must have
* a different value to the value in the previous change entry (or, for
* the first change entry, mCurrent).
*/
template <typename Time, typename T, uint32_t ReservedChanges>
class TimeVarying : public TimeVaryingBase {
@ -79,6 +82,9 @@ public:
}
mChanges.RemoveElementAt(i);
}
if (mCurrent == aValue) {
return;
}
mChanges.InsertElementAt(0, Entry(aTime, aValue));
}
/**