xpconnect-singleton-shutdown
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 105 ebc3ada35b90025e196358904a17f4592a9042a9
permissions -rw-r--r--
State as of now

Sweep dying things at the appropriate time.

diff --git a/js/src/xpconnect/src/nsXPConnect.cpp b/js/src/xpconnect/src/nsXPConnect.cpp
--- a/js/src/xpconnect/src/nsXPConnect.cpp
+++ b/js/src/xpconnect/src/nsXPConnect.cpp
@@ -192,35 +192,6 @@
             xpc->mProfiler->Stop();
             xpc->mProfiler->WriteResults(xpc->mProfilerOutputFile);
         }
-#endif
-
-#ifdef DEBUG
-        // force a dump of the JavaScript gc heap if JS is still alive
-        // if requested through XPC_SHUTDOWN_HEAP_DUMP environment variable
-        XPCCallContext ccx(NATIVE_CALLER);
-        if(ccx.IsValid())
-        {
-            const char* dumpName = getenv("XPC_SHUTDOWN_HEAP_DUMP");
-            if(dumpName)
-            {
-                FILE* dumpFile = (*dumpName == '\0' ||
-                                  strcmp(dumpName, "stdout") == 0)
-                                 ? stdout
-                                 : fopen(dumpName, "w");
-                if(dumpFile)
-                {
-                    JS_DumpHeap(ccx, dumpFile, nsnull, 0, nsnull,
-                                static_cast<size_t>(-1), nsnull);
-                    if(dumpFile != stdout)
-                        fclose(dumpFile);
-                }
-            }
-        }
-#endif
-#ifdef XPC_DUMP_AT_SHUTDOWN
-        // NOTE: to see really interesting stuff turn on the prlog stuff.
-        // See the comment at the top of xpclog.h to see how to do that.
-        xpc->DebugDump(7);
 #endif
     }
 }
diff --git a/js/src/xpconnect/src/xpcjsruntime.cpp b/js/src/xpconnect/src/xpcjsruntime.cpp
--- a/js/src/xpconnect/src/xpcjsruntime.cpp
+++ b/js/src/xpconnect/src/xpcjsruntime.cpp
@@ -188,6 +188,8 @@
 
                 self->mNativeScriptableSharedMap->UnmapDying();
 
+                self->mClassInfo2NativeSetMap->UnmapDyingSets();
+
                 self->mDoingFinalization = JS_TRUE;
                 break;
             }
@@ -249,10 +251,6 @@
                         }
                     }
                 }
-
-                // Do the sweeping...
-
-                self->mClassInfo2NativeSetMap->UnmapDyingSets();
 
 #ifdef XPC_REPORT_NATIVE_INTERFACE_AND_SET_FLUSHING
                 int setsAfter = (int) self->mNativeSetMap->Count();