Reviewed by Darin Adler.
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Jan 2008 04:05:21 +0000 (04:05 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Jan 2008 04:05:21 +0000 (04:05 +0000)
        Fixed: lots of WebCore leaks reported when quitting Safari

        If we're quitting with a GC still scheduled, do the GC before quitting.
        That way, WebCore's leak counters won't count objects that were
        scheduled for GC.

        * bindings/js/GCController.cpp:
        (WebCore::GCController::~GCController):
        (WebCore::GCController::garbageCollectNow):
        * bindings/js/GCController.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29603 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bindings/js/GCController.cpp
WebCore/bindings/js/GCController.h

index 2592c8b3d91b23f08816b81a1633587d5d6a8264..9c33b25e0df91cc19ed96c23bc3a41eeba86a250 100644 (file)
@@ -1,3 +1,18 @@
+2008-01-17  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fixed: lots of WebCore leaks reported when quitting Safari
+        
+        If we're quitting with a GC still scheduled, do the GC before quitting.
+        That way, WebCore's leak counters won't count objects that were
+        scheduled for GC.
+
+        * bindings/js/GCController.cpp:
+        (WebCore::GCController::~GCController):
+        (WebCore::GCController::garbageCollectNow):
+        * bindings/js/GCController.h:
+
 2008-01-17  Alp Toker  <alp@atoker.com>
 
         Reviewed by Oliver Hunt.
index 72545503518d74e6c7d4e50757e0385748959bad..5ae7276f3a25462ed8a236e0e113f0217829a7fa 100644 (file)
@@ -55,6 +55,14 @@ GCController::GCController()
 {
 }
 
+#ifndef NDEBUG
+GCController::~GCController()
+{
+    if (m_GCTimer.isActive())
+        garbageCollectNow();
+}
+#endif
+
 void GCController::garbageCollectSoon()
 {
     if (!m_GCTimer.isActive())
@@ -69,6 +77,8 @@ void GCController::gcTimerFired(Timer<GCController>*)
 
 void GCController::garbageCollectNow()
 {
+    m_GCTimer.stop();
+
     JSLock lock;
     Collector::collect();
 }
index 452019af6b1291f66ebf257eb440ef64cc56ce28..03e00b966569adba8ab5772457d8854406396a66 100644 (file)
@@ -42,6 +42,9 @@ namespace WebCore {
 
     private:
         GCController(); // Use gcController() instead
+#ifndef NDEBUG
+        ~GCController();
+#endif
         void gcTimerFired(Timer<GCController>*);
         
         Timer<GCController> m_GCTimer;