Bug 852117: Add event loop nesting level API to crash reporter; r=ted

--HG--
extra : rebase_source : a7a487371b3bf3d881d245518bc9e0bc11ffb49d
This commit is contained in:
Aaron Klotz 2014-02-13 10:51:09 -07:00
Родитель 7613605596
Коммит 7c448581d3
2 изменённых файлов: 26 добавлений и 0 удалений

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

@ -221,6 +221,10 @@ static const char kIsGarbageCollectingParameter[] = "IsGarbageCollecting=";
static const int kIsGarbageCollectingParameterLen =
sizeof(kIsGarbageCollectingParameter)-1;
static const char kEventLoopNestingLevelParameter[] = "EventLoopNestingLevel=";
static const int kEventLoopNestingLevelParameterLen =
sizeof(kEventLoopNestingLevelParameter)-1;
#ifdef XP_WIN
static const char kBreakpadReserveAddressParameter[] = "BreakpadReserveAddress=";
static const int kBreakpadReserveAddressParameterLen =
@ -238,6 +242,7 @@ static AnnotationTable* crashReporterAPIData_Hash;
static nsCString* crashReporterAPIData = nullptr;
static nsCString* notesField = nullptr;
static bool isGarbageCollecting;
static uint32_t eventloopNestingLevel = 0;
// Avoid a race during application termination.
static Mutex* dumpSafetyLock;
@ -583,6 +588,14 @@ bool MinidumpCallback(
char buffer[128];
int bufferLen;
if (eventloopNestingLevel > 0) {
WriteFile(hFile, kEventLoopNestingLevelParameter, kEventLoopNestingLevelParameterLen,
&nBytes, nullptr);
_ultoa(eventloopNestingLevel, buffer, 10);
WriteFile(hFile, buffer, strlen(buffer), &nBytes, nullptr);
WriteFile(hFile, "\n", 1, &nBytes, nullptr);
}
if (gBreakpadReservedVM) {
WriteFile(hFile, kBreakpadReserveAddressParameter, kBreakpadReserveAddressParameterLen, &nBytes, nullptr);
_ui64toa(uintptr_t(gBreakpadReservedVM), buffer, 10);
@ -685,6 +698,13 @@ bool MinidumpCallback(
unused << sys_write(fd, isGarbageCollecting ? "1" : "0", 1);
unused << sys_write(fd, "\n", 1);
}
if (eventloopNestingLevel > 0) {
unused << sys_write(fd, kEventLoopNestingLevelParameter, kEventLoopNestingLevelParameterLen);
char buffer[16];
XP_TTOA(eventloopNestingLevel, buffer, 10);
unused << sys_write(fd, buffer, my_strlen(buffer));
unused << sys_write(fd, "\n", 1);
}
if (oomAllocationSizeBufferLen) {
unused << sys_write(fd, kOOMAllocationSizeParameter,
kOOMAllocationSizeParameterLen);
@ -1580,6 +1600,11 @@ nsresult SetGarbageCollecting(bool collecting)
return NS_OK;
}
void SetEventloopNestingLevel(uint32_t level)
{
eventloopNestingLevel = level;
}
nsresult AppendAppNotesToCrashReport(const nsACString& data)
{
if (!GetEnabled())

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

@ -48,6 +48,7 @@ nsresult AppendAppNotesToCrashReport(const nsACString& data);
void AnnotateOOMAllocationSize(size_t size);
nsresult SetGarbageCollecting(bool collecting);
void SetEventloopNestingLevel(uint32_t level);
nsresult SetRestartArgs(int argc, char** argv);
nsresult SetupExtraData(nsIFile* aAppDataDirectory,