Backout Bug 953435 to fix bug 959281, a=backout

This commit is contained in:
Olli Pettay 2014-02-02 20:12:27 +02:00
Родитель 1d5269baf5
Коммит e84a8e90a5
6 изменённых файлов: 9 добавлений и 41 удалений

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

@ -109,6 +109,7 @@ protected:
// to 3%-4%). See bmo bug 395397.
static const uint32_t kHadMoreEventsCountMax = 3;
int32_t mRecursionDepth;
int32_t mNativeEventCallbackDepth;
// Can be set from different threads, so must be modified atomically
int32_t mNativeEventScheduledDepth;

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

@ -210,6 +210,7 @@ nsAppShell::nsAppShell()
, mTerminated(false)
, mSkippedNativeCallback(false)
, mHadMoreEventsCount(0)
, mRecursionDepth(0)
, mNativeEventCallbackDepth(0)
, mNativeEventScheduledDepth(0)
{
@ -711,14 +712,11 @@ nsAppShell::ProcessNextNativeEvent(bool aMayWait)
bool
nsAppShell::InGeckoMainEventLoop()
{
if (gXULModalLevel > 0)
if ((gXULModalLevel > 0) || (mRecursionDepth > 0))
return false;
if (mNativeEventCallbackDepth <= 0)
return false;
bool isProcessingEvents = false;
NS_GetCurrentThread()->GetIsProcessingEvents(&isProcessingEvents);
return !isProcessingEvents;
return true;
}
// Run
@ -820,6 +818,8 @@ nsAppShell::OnProcessNextEvent(nsIThreadInternal *aThread, bool aMayWait,
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
mRecursionDepth = aRecursionDepth;
NS_ASSERTION(mAutoreleasePools,
"No stack on which to store autorelease pool");
@ -845,6 +845,8 @@ nsAppShell::AfterProcessNextEvent(nsIThreadInternal *aThread,
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
mRecursionDepth = aRecursionDepth;
CFIndex count = ::CFArrayGetCount(mAutoreleasePools);
NS_ASSERTION(mAutoreleasePools && count,

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

@ -462,17 +462,6 @@ LazyIdleThread::ProcessNextEvent(bool aMayWait,
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP
LazyIdleThread::GetIsProcessingEvents(bool* aIsProcessing)
{
if (mThread) {
return mThread->GetIsProcessingEvents(aIsProcessing);
}
*aIsProcessing = false;
return NS_OK;
}
NS_IMETHODIMP
LazyIdleThread::Notify(nsITimer* aTimer)
{

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

@ -17,7 +17,7 @@
*
* See nsIThreadManager for the API used to create and locate threads.
*/
[scriptable, uuid(4df07d3a-e759-4256-ba4e-7e2265354ec3)]
[scriptable, uuid(9c889946-a73a-4af3-ae9a-ea64f7d4e3ca)]
interface nsIThread : nsIEventTarget
{
/**
@ -82,10 +82,4 @@ interface nsIThread : nsIEventTarget
* not the current thread.
*/
boolean processNextEvent(in boolean mayWait);
/**
* true if we're processing runnables or thread observers and if this is the
* current thread.
*/
readonly attribute boolean isProcessingEvents;
};

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

@ -304,7 +304,6 @@ nsThread::nsThread(MainThreadFlag aMainThread, uint32_t aStackSize)
, mThread(nullptr)
, mRunningEvent(0)
, mStackSize(aStackSize)
, mProcessingEvent(0)
, mShutdownContext(nullptr)
, mShutdownRequired(false)
, mEventsAreDoomed(false)
@ -607,8 +606,6 @@ nsThread::ProcessNextEvent(bool mayWait, bool *result)
}
}
++mProcessingEvent;
bool notifyMainThreadObserver =
(MAIN_THREAD == mIsMainThread) && sMainThreadObserver;
if (notifyMainThreadObserver)
@ -662,22 +659,9 @@ nsThread::ProcessNextEvent(bool mayWait, bool *result)
if (notifyMainThreadObserver && sMainThreadObserver)
sMainThreadObserver->AfterProcessNextEvent(this, mRunningEvent, *result);
--mProcessingEvent;
return rv;
}
NS_IMETHODIMP
nsThread::GetIsProcessingEvents(bool* aIsProcessing)
{
if (NS_WARN_IF(PR_GetCurrentThread() != mThread)) {
return NS_ERROR_NOT_SAME_THREAD;
}
*aIsProcessing = mProcessingEvent != 0;
return NS_OK;
}
//-----------------------------------------------------------------------------
// nsISupportsPriority

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

@ -150,8 +150,6 @@ protected:
uint32_t mRunningEvent; // counter
uint32_t mStackSize;
uint32_t mProcessingEvent;
struct nsThreadShutdownContext *mShutdownContext;
bool mShutdownRequired;