[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:59:20 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit da397079f652bd4281f52afdb629782d6d6546fd
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Mar 28 23:17:15 2002 +0000

    	* src/kdelibs/khtml/misc/loader.h: Added API for looking at the contents of the
            cache, flushing the cache, and disabling the cache.
    	* src/kwq/KWQKloader.mm: (Cache::requestImage): Don't cache if disabled.
            (Cache::requestStyleSheet): Don't cache if disabled.
    	(Cache::requestScript): Don't cache if disabled.
            (Cache::flush): Simplify ifdefs.
            (Cache::getStatistics), (Cache::flushAll), (Cache::setCacheDisabled): New.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@880 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index a413ba5..affb875 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,13 @@
+2002-03-28  Darin Adler  <darin at apple.com>
+
+	* src/kdelibs/khtml/misc/loader.h: Added API for looking at the contents of the
+        cache, flushing the cache, and disabling the cache.
+	* src/kwq/KWQKloader.mm: (Cache::requestImage): Don't cache if disabled.
+        (Cache::requestStyleSheet): Don't cache if disabled.
+	(Cache::requestScript): Don't cache if disabled.
+        (Cache::flush): Simplify ifdefs.
+        (Cache::getStatistics), (Cache::flushAll), (Cache::setCacheDisabled): New.
+
 2002-03-28  Richard Williamson  <rjw at apple.com>
 
         Fixed crasher.  Removed unnecessary cleanup to widget that was called after the
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index a413ba5..affb875 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,13 @@
+2002-03-28  Darin Adler  <darin at apple.com>
+
+	* src/kdelibs/khtml/misc/loader.h: Added API for looking at the contents of the
+        cache, flushing the cache, and disabling the cache.
+	* src/kwq/KWQKloader.mm: (Cache::requestImage): Don't cache if disabled.
+        (Cache::requestStyleSheet): Don't cache if disabled.
+	(Cache::requestScript): Don't cache if disabled.
+        (Cache::flush): Simplify ifdefs.
+        (Cache::getStatistics), (Cache::flushAll), (Cache::setCacheDisabled): New.
+
 2002-03-28  Richard Williamson  <rjw at apple.com>
 
         Fixed crasher.  Removed unnecessary cleanup to widget that was called after the
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index a413ba5..affb875 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,13 @@
+2002-03-28  Darin Adler  <darin at apple.com>
+
+	* src/kdelibs/khtml/misc/loader.h: Added API for looking at the contents of the
+        cache, flushing the cache, and disabling the cache.
+	* src/kwq/KWQKloader.mm: (Cache::requestImage): Don't cache if disabled.
+        (Cache::requestStyleSheet): Don't cache if disabled.
+	(Cache::requestScript): Don't cache if disabled.
+        (Cache::flush): Simplify ifdefs.
+        (Cache::getStatistics), (Cache::flushAll), (Cache::setCacheDisabled): New.
+
 2002-03-28  Richard Williamson  <rjw at apple.com>
 
         Fixed crasher.  Removed unnecessary cleanup to widget that was called after the
diff --git a/WebCore/khtml/misc/loader.h b/WebCore/khtml/misc/loader.h
index c9af58f..7b43881 100644
--- a/WebCore/khtml/misc/loader.h
+++ b/WebCore/khtml/misc/loader.h
@@ -513,6 +513,26 @@ namespace khtml
 
         static void removeCacheEntry( CachedObject *object );
 
+#ifdef APPLE_CHANGES
+        struct TypeStatistic {
+            int count;
+            int size;
+            TypeStatistic() : count(0), size(0) { }
+        };
+        
+        struct Statistics {
+            TypeStatistic images;
+            TypeStatistic movies;
+            TypeStatistic styleSheets;
+            TypeStatistic scripts;
+            TypeStatistic other;
+        };
+
+        static Statistics getStatistics();
+        static void flushAll();
+        static void setCacheDisabled(bool);
+#endif
+
         protected:
 	/*
 	 * @internal
diff --git a/WebCore/kwq/KWQKloader.mm b/WebCore/kwq/KWQKloader.mm
index ebcce79..a3a65c8 100644
--- a/WebCore/kwq/KWQKloader.mm
+++ b/WebCore/kwq/KWQKloader.mm
@@ -65,6 +65,10 @@ using namespace khtml;
 using namespace DOM;
 
 #ifdef APPLE_CHANGES
+static bool cacheDisabled;
+#endif
+
+#ifdef APPLE_CHANGES
 WCIFLoadProgressMakeFunc WCIFLoadProgressMake;
 
 void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func)
@@ -1461,9 +1465,15 @@ CachedImage *Cache::requestImage( DocLoader* dl, const DOMString & url, bool rel
 #endif
         CachedImage *im = new CachedImage(dl, kurl.url(), reload, _expireDate);
         if ( dl && dl->autoloadImages() ) Cache::loader()->load(dl, im, true);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), im );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = im;
     }
 
@@ -1508,9 +1518,15 @@ CachedCSSStyleSheet *Cache::requestStyleSheet( DocLoader* dl, const DOMString &
         kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
 #endif
         CachedCSSStyleSheet *sheet = new CachedCSSStyleSheet(dl, kurl.url(), reload, _expireDate, charset);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), sheet );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = sheet;
     }
 
@@ -1555,9 +1571,15 @@ CachedScript *Cache::requestScript( DocLoader* dl, const DOM::DOMString &url, bo
         kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
 #endif
         CachedScript *script = new CachedScript(dl, kurl.url(), reload, _expireDate, charset);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), script );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = script;
     }
 
@@ -1610,17 +1632,15 @@ void Cache::flush(bool force)
         CachedObject *o = cache->find( url );
 
 #if APPLE_CHANGES
-        if( !o || !o->canDelete() || o->status() == CachedObject::Persistent ) {
-#else /* APPLE_CHANGES not defined */
+        if( !o ) {
+            continue;
+        }
+#endif
+
         if( !o->canDelete() || o->status() == CachedObject::Persistent ) {
-#endif /* APPLE_CHANGES not defined */
                continue; // image is still used or cached permanently
                // in this case don't count it for the size of the cache.
-#if APPLE_CHANGES 
-        } // extra brace to avoid confusing prepare-ChangeLog
-#else /* APPLE_CHANGES not defined */
-	}
-#endif /* APPLE_CHANGES not defined */
+        }
 
         if( o->status() != CachedObject::Uncacheable )
         {
@@ -1710,5 +1730,66 @@ void Cache::removeCacheEntry( CachedObject *object )
      delete object;
 }
 
+#ifdef APPLE_CHANGES
+
+Cache::Statistics Cache::getStatistics()
+{
+    Statistics stats;
+
+    init();
+    
+    QDictIterator<CachedObject> i(*cache);
+    for (i.toFirst(); i.current(); ++i) {
+        CachedObject *o = i.current();
+        switch (o->type()) {
+            case CachedObject::Image:
+                if (static_cast<CachedImage *>(o)->m) {
+                    stats.movies.count++;
+                    stats.movies.size += o->size();
+                } else {
+                    stats.images.count++;
+                    stats.images.size += o->size();
+                }
+                break;
+
+            case CachedObject::CSSStyleSheet:
+                stats.styleSheets.count++;
+                stats.styleSheets.size += o->size();
+                break;
+
+            case CachedObject::Script:
+                stats.scripts.count++;
+                stats.scripts.size += o->size();
+                break;
+
+            default:
+                stats.other.count++;
+                stats.other.size += o->size();
+        }
+    }
+    
+    return stats;
+}
+
+void Cache::flushAll()
+{
+    for (;;) {
+        QDictIterator<CachedObject> i(*cache);
+        CachedObject *o = i.toFirst();
+        if (!o)
+            break;
+        removeCacheEntry(o);
+    }
+    cacheSize = 0;
+}
+
+void Cache::setCacheDisabled(bool disabled)
+{
+    cacheDisabled = disabled;
+    if (disabled)
+        flushAll();
+}
+
+#endif
 
 #include "loader.moc"
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index ebcce79..a3a65c8 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -65,6 +65,10 @@ using namespace khtml;
 using namespace DOM;
 
 #ifdef APPLE_CHANGES
+static bool cacheDisabled;
+#endif
+
+#ifdef APPLE_CHANGES
 WCIFLoadProgressMakeFunc WCIFLoadProgressMake;
 
 void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func)
@@ -1461,9 +1465,15 @@ CachedImage *Cache::requestImage( DocLoader* dl, const DOMString & url, bool rel
 #endif
         CachedImage *im = new CachedImage(dl, kurl.url(), reload, _expireDate);
         if ( dl && dl->autoloadImages() ) Cache::loader()->load(dl, im, true);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), im );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = im;
     }
 
@@ -1508,9 +1518,15 @@ CachedCSSStyleSheet *Cache::requestStyleSheet( DocLoader* dl, const DOMString &
         kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
 #endif
         CachedCSSStyleSheet *sheet = new CachedCSSStyleSheet(dl, kurl.url(), reload, _expireDate, charset);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), sheet );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = sheet;
     }
 
@@ -1555,9 +1571,15 @@ CachedScript *Cache::requestScript( DocLoader* dl, const DOM::DOMString &url, bo
         kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
 #endif
         CachedScript *script = new CachedScript(dl, kurl.url(), reload, _expireDate, charset);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), script );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = script;
     }
 
@@ -1610,17 +1632,15 @@ void Cache::flush(bool force)
         CachedObject *o = cache->find( url );
 
 #if APPLE_CHANGES
-        if( !o || !o->canDelete() || o->status() == CachedObject::Persistent ) {
-#else /* APPLE_CHANGES not defined */
+        if( !o ) {
+            continue;
+        }
+#endif
+
         if( !o->canDelete() || o->status() == CachedObject::Persistent ) {
-#endif /* APPLE_CHANGES not defined */
                continue; // image is still used or cached permanently
                // in this case don't count it for the size of the cache.
-#if APPLE_CHANGES 
-        } // extra brace to avoid confusing prepare-ChangeLog
-#else /* APPLE_CHANGES not defined */
-	}
-#endif /* APPLE_CHANGES not defined */
+        }
 
         if( o->status() != CachedObject::Uncacheable )
         {
@@ -1710,5 +1730,66 @@ void Cache::removeCacheEntry( CachedObject *object )
      delete object;
 }
 
+#ifdef APPLE_CHANGES
+
+Cache::Statistics Cache::getStatistics()
+{
+    Statistics stats;
+
+    init();
+    
+    QDictIterator<CachedObject> i(*cache);
+    for (i.toFirst(); i.current(); ++i) {
+        CachedObject *o = i.current();
+        switch (o->type()) {
+            case CachedObject::Image:
+                if (static_cast<CachedImage *>(o)->m) {
+                    stats.movies.count++;
+                    stats.movies.size += o->size();
+                } else {
+                    stats.images.count++;
+                    stats.images.size += o->size();
+                }
+                break;
+
+            case CachedObject::CSSStyleSheet:
+                stats.styleSheets.count++;
+                stats.styleSheets.size += o->size();
+                break;
+
+            case CachedObject::Script:
+                stats.scripts.count++;
+                stats.scripts.size += o->size();
+                break;
+
+            default:
+                stats.other.count++;
+                stats.other.size += o->size();
+        }
+    }
+    
+    return stats;
+}
+
+void Cache::flushAll()
+{
+    for (;;) {
+        QDictIterator<CachedObject> i(*cache);
+        CachedObject *o = i.toFirst();
+        if (!o)
+            break;
+        removeCacheEntry(o);
+    }
+    cacheSize = 0;
+}
+
+void Cache::setCacheDisabled(bool disabled)
+{
+    cacheDisabled = disabled;
+    if (disabled)
+        flushAll();
+}
+
+#endif
 
 #include "loader.moc"
diff --git a/WebCore/kwq/KWQLoaderImpl.mm b/WebCore/kwq/KWQLoaderImpl.mm
index ebcce79..a3a65c8 100644
--- a/WebCore/kwq/KWQLoaderImpl.mm
+++ b/WebCore/kwq/KWQLoaderImpl.mm
@@ -65,6 +65,10 @@ using namespace khtml;
 using namespace DOM;
 
 #ifdef APPLE_CHANGES
+static bool cacheDisabled;
+#endif
+
+#ifdef APPLE_CHANGES
 WCIFLoadProgressMakeFunc WCIFLoadProgressMake;
 
 void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func)
@@ -1461,9 +1465,15 @@ CachedImage *Cache::requestImage( DocLoader* dl, const DOMString & url, bool rel
 #endif
         CachedImage *im = new CachedImage(dl, kurl.url(), reload, _expireDate);
         if ( dl && dl->autoloadImages() ) Cache::loader()->load(dl, im, true);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), im );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = im;
     }
 
@@ -1508,9 +1518,15 @@ CachedCSSStyleSheet *Cache::requestStyleSheet( DocLoader* dl, const DOMString &
         kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
 #endif
         CachedCSSStyleSheet *sheet = new CachedCSSStyleSheet(dl, kurl.url(), reload, _expireDate, charset);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), sheet );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = sheet;
     }
 
@@ -1555,9 +1571,15 @@ CachedScript *Cache::requestScript( DocLoader* dl, const DOM::DOMString &url, bo
         kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
 #endif
         CachedScript *script = new CachedScript(dl, kurl.url(), reload, _expireDate, charset);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), script );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = script;
     }
 
@@ -1610,17 +1632,15 @@ void Cache::flush(bool force)
         CachedObject *o = cache->find( url );
 
 #if APPLE_CHANGES
-        if( !o || !o->canDelete() || o->status() == CachedObject::Persistent ) {
-#else /* APPLE_CHANGES not defined */
+        if( !o ) {
+            continue;
+        }
+#endif
+
         if( !o->canDelete() || o->status() == CachedObject::Persistent ) {
-#endif /* APPLE_CHANGES not defined */
                continue; // image is still used or cached permanently
                // in this case don't count it for the size of the cache.
-#if APPLE_CHANGES 
-        } // extra brace to avoid confusing prepare-ChangeLog
-#else /* APPLE_CHANGES not defined */
-	}
-#endif /* APPLE_CHANGES not defined */
+        }
 
         if( o->status() != CachedObject::Uncacheable )
         {
@@ -1710,5 +1730,66 @@ void Cache::removeCacheEntry( CachedObject *object )
      delete object;
 }
 
+#ifdef APPLE_CHANGES
+
+Cache::Statistics Cache::getStatistics()
+{
+    Statistics stats;
+
+    init();
+    
+    QDictIterator<CachedObject> i(*cache);
+    for (i.toFirst(); i.current(); ++i) {
+        CachedObject *o = i.current();
+        switch (o->type()) {
+            case CachedObject::Image:
+                if (static_cast<CachedImage *>(o)->m) {
+                    stats.movies.count++;
+                    stats.movies.size += o->size();
+                } else {
+                    stats.images.count++;
+                    stats.images.size += o->size();
+                }
+                break;
+
+            case CachedObject::CSSStyleSheet:
+                stats.styleSheets.count++;
+                stats.styleSheets.size += o->size();
+                break;
+
+            case CachedObject::Script:
+                stats.scripts.count++;
+                stats.scripts.size += o->size();
+                break;
+
+            default:
+                stats.other.count++;
+                stats.other.size += o->size();
+        }
+    }
+    
+    return stats;
+}
+
+void Cache::flushAll()
+{
+    for (;;) {
+        QDictIterator<CachedObject> i(*cache);
+        CachedObject *o = i.toFirst();
+        if (!o)
+            break;
+        removeCacheEntry(o);
+    }
+    cacheSize = 0;
+}
+
+void Cache::setCacheDisabled(bool disabled)
+{
+    cacheDisabled = disabled;
+    if (disabled)
+        flushAll();
+}
+
+#endif
 
 #include "loader.moc"
diff --git a/WebCore/src/kdelibs/khtml/misc/loader.h b/WebCore/src/kdelibs/khtml/misc/loader.h
index c9af58f..7b43881 100644
--- a/WebCore/src/kdelibs/khtml/misc/loader.h
+++ b/WebCore/src/kdelibs/khtml/misc/loader.h
@@ -513,6 +513,26 @@ namespace khtml
 
         static void removeCacheEntry( CachedObject *object );
 
+#ifdef APPLE_CHANGES
+        struct TypeStatistic {
+            int count;
+            int size;
+            TypeStatistic() : count(0), size(0) { }
+        };
+        
+        struct Statistics {
+            TypeStatistic images;
+            TypeStatistic movies;
+            TypeStatistic styleSheets;
+            TypeStatistic scripts;
+            TypeStatistic other;
+        };
+
+        static Statistics getStatistics();
+        static void flushAll();
+        static void setCacheDisabled(bool);
+#endif
+
         protected:
 	/*
 	 * @internal
diff --git a/WebCore/src/kwq/KWQKloader.mm b/WebCore/src/kwq/KWQKloader.mm
index ebcce79..a3a65c8 100644
--- a/WebCore/src/kwq/KWQKloader.mm
+++ b/WebCore/src/kwq/KWQKloader.mm
@@ -65,6 +65,10 @@ using namespace khtml;
 using namespace DOM;
 
 #ifdef APPLE_CHANGES
+static bool cacheDisabled;
+#endif
+
+#ifdef APPLE_CHANGES
 WCIFLoadProgressMakeFunc WCIFLoadProgressMake;
 
 void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func)
@@ -1461,9 +1465,15 @@ CachedImage *Cache::requestImage( DocLoader* dl, const DOMString & url, bool rel
 #endif
         CachedImage *im = new CachedImage(dl, kurl.url(), reload, _expireDate);
         if ( dl && dl->autoloadImages() ) Cache::loader()->load(dl, im, true);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), im );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = im;
     }
 
@@ -1508,9 +1518,15 @@ CachedCSSStyleSheet *Cache::requestStyleSheet( DocLoader* dl, const DOMString &
         kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
 #endif
         CachedCSSStyleSheet *sheet = new CachedCSSStyleSheet(dl, kurl.url(), reload, _expireDate, charset);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), sheet );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = sheet;
     }
 
@@ -1555,9 +1571,15 @@ CachedScript *Cache::requestScript( DocLoader* dl, const DOM::DOMString &url, bo
         kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
 #endif
         CachedScript *script = new CachedScript(dl, kurl.url(), reload, _expireDate, charset);
+#ifdef APPLE_CHANGES
+        if (!cacheDisabled) {
+#endif
         cache->insert( kurl.url(), script );
         lru->prepend( kurl.url() );
         flush();
+#ifdef APPLE_CHANGES
+        }
+#endif
         o = script;
     }
 
@@ -1610,17 +1632,15 @@ void Cache::flush(bool force)
         CachedObject *o = cache->find( url );
 
 #if APPLE_CHANGES
-        if( !o || !o->canDelete() || o->status() == CachedObject::Persistent ) {
-#else /* APPLE_CHANGES not defined */
+        if( !o ) {
+            continue;
+        }
+#endif
+
         if( !o->canDelete() || o->status() == CachedObject::Persistent ) {
-#endif /* APPLE_CHANGES not defined */
                continue; // image is still used or cached permanently
                // in this case don't count it for the size of the cache.
-#if APPLE_CHANGES 
-        } // extra brace to avoid confusing prepare-ChangeLog
-#else /* APPLE_CHANGES not defined */
-	}
-#endif /* APPLE_CHANGES not defined */
+        }
 
         if( o->status() != CachedObject::Uncacheable )
         {
@@ -1710,5 +1730,66 @@ void Cache::removeCacheEntry( CachedObject *object )
      delete object;
 }
 
+#ifdef APPLE_CHANGES
+
+Cache::Statistics Cache::getStatistics()
+{
+    Statistics stats;
+
+    init();
+    
+    QDictIterator<CachedObject> i(*cache);
+    for (i.toFirst(); i.current(); ++i) {
+        CachedObject *o = i.current();
+        switch (o->type()) {
+            case CachedObject::Image:
+                if (static_cast<CachedImage *>(o)->m) {
+                    stats.movies.count++;
+                    stats.movies.size += o->size();
+                } else {
+                    stats.images.count++;
+                    stats.images.size += o->size();
+                }
+                break;
+
+            case CachedObject::CSSStyleSheet:
+                stats.styleSheets.count++;
+                stats.styleSheets.size += o->size();
+                break;
+
+            case CachedObject::Script:
+                stats.scripts.count++;
+                stats.scripts.size += o->size();
+                break;
+
+            default:
+                stats.other.count++;
+                stats.other.size += o->size();
+        }
+    }
+    
+    return stats;
+}
+
+void Cache::flushAll()
+{
+    for (;;) {
+        QDictIterator<CachedObject> i(*cache);
+        CachedObject *o = i.toFirst();
+        if (!o)
+            break;
+        removeCacheEntry(o);
+    }
+    cacheSize = 0;
+}
+
+void Cache::setCacheDisabled(bool disabled)
+{
+    cacheDisabled = disabled;
+    if (disabled)
+        flushAll();
+}
+
+#endif
 
 #include "loader.moc"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list