Add a leak counter for CachedResources since we've had two recent leaks involving...
authormrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Oct 2008 06:53:49 +0000 (06:53 +0000)
committermrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Oct 2008 06:53:49 +0000 (06:53 +0000)
Reviewed by Dan Bernstein.

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

WebCore/ChangeLog
WebCore/loader/CachedResource.cpp
WebKitTools/ChangeLog
WebKitTools/Scripts/check-for-global-initializers

index 5c3a437..458dd2b 100644 (file)
@@ -1,3 +1,13 @@
+2008-09-30  Mark Rowe  <mrowe@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Add a leak counter for CachedResources since we've had two recent leaks involving them.
+
+        * loader/CachedResource.cpp:
+        (WebCore::CachedResource::CachedResource):
+        (WebCore::CachedResource::~CachedResource):
+
 2008-09-30  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Dave Hyatt.
index 4bf5d44..08855ab 100644 (file)
 #include "Request.h"
 #include "SystemTime.h"
 #include <wtf/Vector.h>
+#include <wtf/RefCountedLeakCounter.h>
+
+using namespace WTF;
 
 namespace WebCore {
 
+#ifndef NDEBUG
+static RefCountedLeakCounter cachedResourceLeakCounter("CachedResource");
+#endif
+
 CachedResource::CachedResource(const String& url, Type type)
     : m_url(url)
     , m_lastDecodedAccessTime(0)
@@ -51,6 +58,10 @@ CachedResource::CachedResource(const String& url, Type type)
     , m_isBeingRevalidated(false)
     , m_expirationDate(0)
 {
+#ifndef NDEBUG
+    cachedResourceLeakCounter.increment();
+#endif
+
     m_type = type;
     m_status = Pending;
     m_encodedSize = 0;
@@ -80,6 +91,7 @@ CachedResource::~CachedResource()
     ASSERT(url().isNull() || cache()->resourceForURL(url()) != this);
 #ifndef NDEBUG
     m_deleted = true;
+    cachedResourceLeakCounter.decrement();
 #endif
 
     if (m_resourceToRevalidate)
index ef8e5ac..1d14fab 100644 (file)
@@ -1,5 +1,13 @@
 2008-09-30  Mark Rowe  <mrowe@apple.com>
 
+        Reviewed by Dan Bernstein.
+
+        Add a leak counter for CachedResources since we've had two recent leaks involving them.
+
+        * Scripts/check-for-global-initializers:
+
+2008-09-30  Mark Rowe  <mrowe@apple.com>
+
         Rubber-stamped by Dan Bernstein.
 
         Fix many leaks seen on fast/backgrounds/svg-as-background-1.html.
index 24f5fc3..1bbeb58 100755 (executable)
@@ -100,6 +100,7 @@ for my $file (sort @files) {
             }
             if ($target eq "WebCore") {
                 next if $shortName eq "CachedPage.o";
+                next if $shortName eq "CachedResource.o";
                 next if $shortName eq "Frame.o";
                 next if $shortName eq "JSCustomSQLTransactionCallback.o";
                 next if $shortName eq "JSEventListener.o";