Title: [93060] trunk/Source/WebKit/chromium
Revision
93060
Author
mnaga...@chromium.org
Date
2011-08-15 14:28:13 -0700 (Mon, 15 Aug 2011)

Log Message

Chromium: expose MemoryCache::prune and FontCache::purgeInactiveFontData.
https://bugs.webkit.org/show_bug.cgi?id=66132

Reviewed by Darin Fisher.

* public/WebCache.h:
* public/WebFontCache.h:
* src/WebCache.cpp:
(WebKit::WebCache::prune):
* src/WebFontCache.cpp:
(WebKit::WebFontCache::prune):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (93059 => 93060)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-08-15 21:12:11 UTC (rev 93059)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-08-15 21:28:13 UTC (rev 93060)
@@ -1,3 +1,17 @@
+2011-08-15  Mikhail Naganov  <mnaga...@chromium.org>
+
+        Chromium: expose MemoryCache::prune and FontCache::purgeInactiveFontData.
+        https://bugs.webkit.org/show_bug.cgi?id=66132
+
+        Reviewed by Darin Fisher.
+
+        * public/WebCache.h:
+        * public/WebFontCache.h:
+        * src/WebCache.cpp:
+        (WebKit::WebCache::prune):
+        * src/WebFontCache.cpp:
+        (WebKit::WebFontCache::prune):
+
 2011-08-15  Nico Weber  <tha...@chromium.org>
 
         [chromium] Implement shouldRubberBandInDirection

Modified: trunk/Source/WebKit/chromium/public/WebCache.h (93059 => 93060)


--- trunk/Source/WebKit/chromium/public/WebCache.h	2011-08-15 21:12:11 UTC (rev 93059)
+++ trunk/Source/WebKit/chromium/public/WebCache.h	2011-08-15 21:28:13 UTC (rev 93060)
@@ -71,9 +71,14 @@
                                             size_t capacity);
 
     // Clears the cache (as much as possible; some resources may not be
-    // cleared if they are actively referenced).
+    // cleared if they are actively referenced). Note that this method
+    // only removes resources from live list, w/o releasing cache memory.
     WEBKIT_EXPORT static void clear();
 
+    // Prunes resource cache. Destroys decoded images data and returns
+    // memory to the system.
+    WEBKIT_EXPORT static void prune();
+
     // Gets the usage statistics from the resource cache.
     WEBKIT_EXPORT static void getUsageStats(UsageStats*);
 

Modified: trunk/Source/WebKit/chromium/public/WebFontCache.h (93059 => 93060)


--- trunk/Source/WebKit/chromium/public/WebFontCache.h	2011-08-15 21:12:11 UTC (rev 93059)
+++ trunk/Source/WebKit/chromium/public/WebFontCache.h	2011-08-15 21:28:13 UTC (rev 93060)
@@ -47,6 +47,9 @@
     // Clears the cache.
     WEBKIT_EXPORT static void clear();
 
+    // Purges inactive font data.
+    WEBKIT_EXPORT static void prune();
+
 private:
     WebFontCache();  // Not intended to be instanced.
 };

Modified: trunk/Source/WebKit/chromium/src/WebCache.cpp (93059 => 93060)


--- trunk/Source/WebKit/chromium/src/WebCache.cpp	2011-08-15 21:12:11 UTC (rev 93059)
+++ trunk/Source/WebKit/chromium/src/WebCache.cpp	2011-08-15 21:28:13 UTC (rev 93060)
@@ -66,12 +66,17 @@
 void WebCache::clear()
 {
     MemoryCache* cache = WebCore::memoryCache();
-    if (cache && !cache->disabled()) {
-        cache->setDisabled(true);
-        cache->setDisabled(false);
-    }
+    if (cache)
+        cache->evictResources();
 }
 
+void WebCache::prune()
+{
+    MemoryCache* cache = WebCore::memoryCache();
+    if (cache)
+        cache->prune();
+}
+
 void WebCache::getUsageStats(UsageStats* result)
 {
     ASSERT(result);

Modified: trunk/Source/WebKit/chromium/src/WebFontCache.cpp (93059 => 93060)


--- trunk/Source/WebKit/chromium/src/WebFontCache.cpp	2011-08-15 21:12:11 UTC (rev 93059)
+++ trunk/Source/WebKit/chromium/src/WebFontCache.cpp	2011-08-15 21:28:13 UTC (rev 93060)
@@ -55,4 +55,10 @@
     fontCache()->invalidate();
 }
 
+// static
+void WebFontCache::prune()
+{
+    fontCache()->purgeInactiveFontData();
+}
+
 }  // namespace WebKit
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to