Bug 1182979 - Part 3: Use nsTHashtable::Iterator in GMPTimerParent. r=cpearce

This commit is contained in:
Birunthan Mohanathas 2015-07-16 10:59:41 -07:00
parent 19c7c31b38
commit fce323b4d9
2 changed files with 7 additions and 14 deletions

View File

@ -70,21 +70,17 @@ GMPTimerParent::Shutdown()
LOGD(("%s::%s: %p mIsOpen=%d", __CLASS__, __FUNCTION__, this, mIsOpen)); LOGD(("%s::%s: %p mIsOpen=%d", __CLASS__, __FUNCTION__, this, mIsOpen));
MOZ_ASSERT(mGMPThread == NS_GetCurrentThread()); MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
mTimers.EnumerateEntries(GMPTimerParent::CancelTimers, nullptr);
for (auto iter = mTimers.Iter(); !iter.Done(); iter.Next()) {
Context* context = iter.Get()->GetKey();
context->mTimer->Cancel();
delete context;
}
mTimers.Clear(); mTimers.Clear();
mIsOpen = false; mIsOpen = false;
} }
/*static */
PLDHashOperator
GMPTimerParent::CancelTimers(nsPtrHashKey<Context>* aContext, void* aClosure)
{
auto context = aContext->GetKey();
context->mTimer->Cancel();
delete context;
return PL_DHASH_NEXT;
}
void void
GMPTimerParent::ActorDestroy(ActorDestroyReason aWhy) GMPTimerParent::ActorDestroy(ActorDestroyReason aWhy)
{ {

View File

@ -47,9 +47,6 @@ private:
uint32_t mId; uint32_t mId;
}; };
static PLDHashOperator
CancelTimers(nsPtrHashKey<Context>* aContext, void* aClosure);
void TimerExpired(Context* aContext); void TimerExpired(Context* aContext);
nsTHashtable<nsPtrHashKey<Context>> mTimers; nsTHashtable<nsPtrHashKey<Context>> mTimers;