Bug 1147555 - Invert the ordering of our priority queue. r=mattwoodrow

This commit is contained in:
Bobby Holley 2015-03-30 15:14:48 -07:00
parent b05a2ce963
commit 97cc33ac66
2 changed files with 6 additions and 1 deletions

View File

@ -111,7 +111,9 @@ MediaTimer::UpdateLocked()
TimeStamp now = TimeStamp::Now();
while (!mEntries.empty() && mEntries.top().mTimeStamp <= now) {
mEntries.top().mPromise->Resolve(true, __func__);
DebugOnly<TimeStamp> poppedTimeStamp = mEntries.top().mTimeStamp;
mEntries.pop();
MOZ_ASSERT_IF(!mEntries.empty(), *&poppedTimeStamp <= mEntries.top().mTimeStamp);
}
// If we've got no more entries, cancel any pending timer and bail out.

View File

@ -78,9 +78,12 @@ private:
, mPromise(new MediaTimerPromise::Private(aCallSite))
{}
// Define a < overload that reverses ordering because std::priority_queue
// provides access to the largest element, and we want the smallest
// (i.e. the soonest).
bool operator<(const Entry& aOther) const
{
return mTimeStamp < aOther.mTimeStamp;
return mTimeStamp > aOther.mTimeStamp;
}
};