Title: [100472] trunk/Source/WebKit/efl
Revision
100472
Author
commit-qu...@webkit.org
Date
2011-11-16 11:03:49 -0800 (Wed, 16 Nov 2011)

Log Message

[EFL] Add ewk_settings_memory_cache_clear().
https://bugs.webkit.org/show_bug.cgi?id=72141

Patch by Raphael Kubo da Costa <k...@profusion.mobi> on 2011-11-16
Reviewed by Kenneth Rohde Christiansen.

This is the same as Qt's QWebSettings::clearMemoryCaches() and is
responsible for clearing, among others, the page, memory and font
caches.

* ewk/ewk_settings.cpp:
(ewk_settings_memory_cache_clear):
* ewk/ewk_settings.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (100471 => 100472)


--- trunk/Source/WebKit/efl/ChangeLog	2011-11-16 19:03:00 UTC (rev 100471)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-11-16 19:03:49 UTC (rev 100472)
@@ -1,5 +1,20 @@
 2011-11-16  Raphael Kubo da Costa  <k...@profusion.mobi>
 
+        [EFL] Add ewk_settings_memory_cache_clear().
+        https://bugs.webkit.org/show_bug.cgi?id=72141
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        This is the same as Qt's QWebSettings::clearMemoryCaches() and is
+        responsible for clearing, among others, the page, memory and font
+        caches.
+
+        * ewk/ewk_settings.cpp:
+        (ewk_settings_memory_cache_clear):
+        * ewk/ewk_settings.h:
+
+2011-11-16  Raphael Kubo da Costa  <k...@profusion.mobi>
+
         [EFL] Clean up the web database-related functions in ewk_settings.
         https://bugs.webkit.org/show_bug.cgi?id=72139
 

Modified: trunk/Source/WebKit/efl/ewk/ewk_settings.cpp (100471 => 100472)


--- trunk/Source/WebKit/efl/ewk/ewk_settings.cpp	2011-11-16 19:03:00 UTC (rev 100471)
+++ trunk/Source/WebKit/efl/ewk/ewk_settings.cpp	2011-11-16 19:03:49 UTC (rev 100472)
@@ -21,14 +21,17 @@
 #include "config.h"
 #include "ewk_settings.h"
 
+#include "CrossOriginPreflightResultCache.h"
 #include "DatabaseTracker.h"
 #include "EWebKit.h"
+#include "FontCache.h"
 #include "FrameView.h"
 #include "IconDatabase.h"
 #include "Image.h"
 #include "IntSize.h"
 #include "KURL.h"
 #include "MemoryCache.h"
+#include "PageCache.h"
 // FIXME: Why is there a directory in this include?
 #include "appcache/ApplicationCacheStorage.h"
 #include "ewk_private.h"
@@ -209,6 +212,29 @@
     cache->setCapacities(0, capacity, capacity);
 }
 
+void ewk_settings_memory_cache_clear()
+{
+    // Turn the cache on and off. Disabling the object cache will remove all
+    // resources from the cache. They may still live on if they are referenced
+    // by some Web page though.
+    if (!WebCore::memoryCache()->disabled()) {
+        WebCore::memoryCache()->setDisabled(true);
+        WebCore::memoryCache()->setDisabled(false);
+    }
+
+    int pageCapacity = WebCore::pageCache()->capacity();
+    // Setting size to 0, makes all pages be released.
+    WebCore::pageCache()->setCapacity(0);
+    WebCore::pageCache()->releaseAutoreleasedPagesNow();
+    WebCore::pageCache()->setCapacity(pageCapacity);
+
+    // Invalidating the font cache and freeing all inactive font data.
+    WebCore::fontCache()->invalidate();
+
+    // Empty the Cross-Origin Preflight cache
+    WebCore::CrossOriginPreflightResultCache::shared().empty();
+}
+
 void ewk_settings_repaint_throttling_set(double deferredRepaintDelay, double initialDeferredRepaintDelayDuringLoading, double maxDeferredRepaintDelayDuringLoading, double deferredRepaintDelayIncrementDuringLoading)
 {
     WebCore::FrameView::setRepaintThrottlingDeferredRepaintDelay(deferredRepaintDelay);

Modified: trunk/Source/WebKit/efl/ewk/ewk_settings.h (100471 => 100472)


--- trunk/Source/WebKit/efl/ewk/ewk_settings.h	2011-11-16 19:03:00 UTC (rev 100471)
+++ trunk/Source/WebKit/efl/ewk/ewk_settings.h	2011-11-16 19:03:49 UTC (rev 100472)
@@ -186,6 +186,15 @@
 EAPI void             ewk_settings_cache_capacity_set(unsigned capacity);
 
 /**
+ * Clears all memory caches.
+ *
+ * This function clears all memory caches, which include the object cache (for resources such as
+ * images, scripts and stylesheets), the page cache, the font cache and the Cross-Origin Preflight
+ * cache.
+ */
+EAPI void             ewk_settings_memory_cache_clear(void);
+
+/**
  * Sets values for repaint throttling.
  *
  * It allows to slow down page loading and
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to