Bug 1122420 - Improve after-shutdown dispatch assertion on CacheIOThread. r=michal

--HG--
extra : rebase_source : f4e438e004b4e18e81ce35db5659a6c9cef18ce1
This commit is contained in:
Honza Bambas 2015-04-13 16:58:00 +02:00
parent 827fee71cd
commit adddf68b3c
2 changed files with 7 additions and 1 deletions

View File

@ -27,6 +27,7 @@ CacheIOThread::CacheIOThread()
, mHasXPCOMEvents(false)
, mRerunCurrentEvent(false)
, mShutdown(false)
, mInsideLoop(true)
{
sSelf = this;
}
@ -237,6 +238,9 @@ loopStart:
} while (true);
MOZ_ASSERT(!EventsPending());
// This is for correct assertion on XPCOM events dispatch.
mInsideLoop = false;
} // lock
if (threadInternal)
@ -313,7 +317,7 @@ NS_IMETHODIMP CacheIOThread::OnDispatchedEvent(nsIThreadInternal *thread)
{
MonitorAutoLock lock(mMonitor);
mHasXPCOMEvents = true;
MOZ_ASSERT(!mShutdown || (PR_GetCurrentThread() == mThread));
MOZ_ASSERT(mInsideLoop);
lock.Notify();
return NS_OK;
}

View File

@ -11,6 +11,7 @@
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "mozilla/Monitor.h"
#include "mozilla/DebugOnly.h"
class nsIRunnable;
@ -94,6 +95,7 @@ private:
bool mHasXPCOMEvents;
bool mRerunCurrentEvent;
bool mShutdown;
DebugOnly<bool> mInsideLoop;
};
} // net