Bug 852117: Modify nsBaseAppShell to notify the crash reporter when the event loop nesting level changes; r=roc

--HG--
extra : rebase_source : 4216520beb56f4e87bb77c89a4edc0cf9a02b658
This commit is contained in:
Aaron Klotz 2014-02-13 10:54:10 -07:00
Родитель 7c448581d3
Коммит 1a55b7e482
2 изменённых файлов: 28 добавлений и 4 удалений

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

@ -6,6 +6,9 @@
#include "base/message_loop.h"
#include "nsBaseAppShell.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif
#include "nsThreadUtils.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
@ -90,7 +93,7 @@ nsBaseAppShell::NativeEventCallback()
mBlockNativeEvent = true;
}
++mEventloopNestingLevel;
IncrementEventloopNestingLevel();
EventloopNestingState prevVal = mEventloopNestingState;
NS_ProcessPendingEvents(thread, THREAD_EVENT_STARVATION_LIMIT);
mProcessedGeckoEvents = true;
@ -102,7 +105,7 @@ nsBaseAppShell::NativeEventCallback()
if (NS_HasPendingEvents(thread))
DoProcessMoreGeckoEvents();
--mEventloopNestingLevel;
DecrementEventloopNestingLevel();
}
// Note, this is currently overidden on windows, see comments in nsAppShell for
@ -132,7 +135,7 @@ nsBaseAppShell::DoProcessNextNativeEvent(bool mayWait, uint32_t recursionDepth)
EventloopNestingState prevVal = mEventloopNestingState;
mEventloopNestingState = eEventloopXPCOM;
++mEventloopNestingLevel;
IncrementEventloopNestingLevel();
bool result = ProcessNextNativeEvent(mayWait);
@ -141,7 +144,7 @@ nsBaseAppShell::DoProcessNextNativeEvent(bool mayWait, uint32_t recursionDepth)
// to the event loop yet.
RunSyncSections(false, recursionDepth);
--mEventloopNestingLevel;
DecrementEventloopNestingLevel();
mEventloopNestingState = prevVal;
return result;
@ -322,6 +325,24 @@ nsBaseAppShell::DispatchDummyEvent(nsIThread* aTarget)
return NS_SUCCEEDED(aTarget->Dispatch(mDummyEvent, NS_DISPATCH_NORMAL));
}
void
nsBaseAppShell::IncrementEventloopNestingLevel()
{
++mEventloopNestingLevel;
#if defined(MOZ_CRASHREPORTER)
CrashReporter::SetEventloopNestingLevel(mEventloopNestingLevel);
#endif
}
void
nsBaseAppShell::DecrementEventloopNestingLevel()
{
--mEventloopNestingLevel;
#if defined(MOZ_CRASHREPORTER)
CrashReporter::SetEventloopNestingLevel(mEventloopNestingLevel);
#endif
}
void
nsBaseAppShell::RunSyncSectionsInternal(bool aStable,
uint32_t aThreadRecursionLevel)

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

@ -79,6 +79,9 @@ private:
bool DispatchDummyEvent(nsIThread* target);
void IncrementEventloopNestingLevel();
void DecrementEventloopNestingLevel();
/**
* Runs all synchronous sections which are queued up in mSyncSections.
*/