mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
debug only: warn when stacks of event queues get surprisingly deep. should speed future attempts to debug problems like bug 206947. r=brendan
This commit is contained in:
parent
c20da37f7d
commit
579f5d88fb
@ -47,6 +47,10 @@
|
||||
|
||||
#include "prlog.h"
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#include "prprf.h"
|
||||
#endif
|
||||
|
||||
#if defined(PR_LOGGING) && defined(DEBUG_danm)
|
||||
/* found these logs useful in conjunction with netlibStreamEvent logging
|
||||
from netwerk. */
|
||||
@ -509,6 +513,21 @@ nsEventQueueImpl::AppendQueue(nsIEventQueue *aQueue)
|
||||
*/
|
||||
rv = NS_ERROR_NO_INTERFACE;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
int depth = 0;
|
||||
nsEventQueueImpl *next = this;
|
||||
while (next && depth < 100) {
|
||||
next = NS_STATIC_CAST(nsEventQueueImpl *, next->mYoungerQueue);
|
||||
++depth;
|
||||
}
|
||||
if (depth > 5) {
|
||||
char warning[80];
|
||||
PR_snprintf(warning, sizeof(warning),
|
||||
"event queue chain length is %d. this is almost certainly a leak.", depth);
|
||||
NS_WARNING(warning);
|
||||
}
|
||||
#endif
|
||||
|
||||
// (be careful doing this outside nsEventQueueService's mEventQMonitor)
|
||||
|
||||
GetYoungest(getter_AddRefs(end));
|
||||
|
Loading…
Reference in New Issue
Block a user