Title: [102971] trunk/Source/WebKit/efl
Revision
102971
Author
[email protected]
Date
2011-12-15 11:45:35 -0800 (Thu, 15 Dec 2011)

Log Message

[EFL] Clean up and refactor the memory cache functions in ewk_settings.
https://bugs.webkit.org/show_bug.cgi?id=72140

Reviewed by Antonio Gomes.

Use a better naming prefix, as "ewk_settings_cache" was too general,
and make it possible to pass all parameters to
MemoryCache::setCapacities().

* ewk/ewk_settings.cpp:
(ewk_settings_object_cache_capacity_set):
(ewk_settings_object_cache_enable_get):
(ewk_settings_object_cache_enable_set):
* ewk/ewk_settings.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (102970 => 102971)


--- trunk/Source/WebKit/efl/ChangeLog	2011-12-15 19:34:20 UTC (rev 102970)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-12-15 19:45:35 UTC (rev 102971)
@@ -1,5 +1,22 @@
 2011-12-15  Raphael Kubo da Costa  <[email protected]>
 
+        [EFL] Clean up and refactor the memory cache functions in ewk_settings.
+        https://bugs.webkit.org/show_bug.cgi?id=72140
+
+        Reviewed by Antonio Gomes.
+
+        Use a better naming prefix, as "ewk_settings_cache" was too general,
+        and make it possible to pass all parameters to
+        MemoryCache::setCapacities().
+
+        * ewk/ewk_settings.cpp:
+        (ewk_settings_object_cache_capacity_set):
+        (ewk_settings_object_cache_enable_get):
+        (ewk_settings_object_cache_enable_set):
+        * ewk/ewk_settings.h:
+
+2011-12-15  Raphael Kubo da Costa  <[email protected]>
+
         [EFL] Add a few more web database functions to ewk_settings.
         https://bugs.webkit.org/show_bug.cgi?id=72148
 

Modified: trunk/Source/WebKit/efl/ewk/ewk_settings.cpp (102970 => 102971)


--- trunk/Source/WebKit/efl/ewk/ewk_settings.cpp	2011-12-15 19:34:20 UTC (rev 102970)
+++ trunk/Source/WebKit/efl/ewk/ewk_settings.cpp	2011-12-15 19:45:35 UTC (rev 102971)
@@ -220,24 +220,19 @@
     return ewk_util_image_from_cairo_surface_add(canvas, surface);
 }
 
-Eina_Bool ewk_settings_cache_enable_get(void)
+void ewk_settings_object_cache_capacity_set(unsigned minDeadCapacity, unsigned maxDeadCapacity, unsigned totalCapacity)
 {
-    WebCore::MemoryCache* cache = WebCore::memoryCache();
-    return !cache->disabled();
+    WebCore::memoryCache()->setCapacities(minDeadCapacity, maxDeadCapacity, totalCapacity);
 }
 
-void ewk_settings_cache_enable_set(Eina_Bool set)
+Eina_Bool ewk_settings_object_cache_enable_get()
 {
-    WebCore::MemoryCache* cache = WebCore::memoryCache();
-    set = !set;
-    if (cache->disabled() != set)
-        cache->setDisabled(set);
+    return !WebCore::memoryCache()->disabled();
 }
 
-void ewk_settings_cache_capacity_set(unsigned capacity)
+void ewk_settings_object_cache_enable_set(Eina_Bool enable)
 {
-    WebCore::MemoryCache* cache = WebCore::memoryCache();
-    cache->setCapacities(0, capacity, capacity);
+    WebCore::memoryCache()->setDisabled(!enable);
 }
 
 void ewk_settings_memory_cache_clear()

Modified: trunk/Source/WebKit/efl/ewk/ewk_settings.h (102970 => 102971)


--- trunk/Source/WebKit/efl/ewk/ewk_settings.h	2011-12-15 19:34:20 UTC (rev 102970)
+++ trunk/Source/WebKit/efl/ewk/ewk_settings.h	2011-12-15 19:45:35 UTC (rev 102971)
@@ -203,30 +203,51 @@
 EAPI void             ewk_settings_application_cache_clear(void);
 
 /**
- * Gets status of the memory cache of WebCore.
+ * Returns whether the in-memory object cache is enabled.
  *
+ * The object cache is responsible for holding resources such as scripts, stylesheets
+ * and images in memory.
+ *
+ * By default, the cache is enabled.
+ *
  * @return @c EINA_TRUE if the cache is enabled or @c EINA_FALSE if not
+ *
+ * @sa ewk_settings_object_cache_capacity_set
  */
-EAPI Eina_Bool        ewk_settings_cache_enable_get(void);
+EAPI Eina_Bool        ewk_settings_object_cache_enable_get(void);
 
 /**
- * Enables/disables the memory cache of WebCore, possibly clearing it.
+ * Enables/disables the in-memory object cache of WebCore, possibly clearing it.
  *
+ * The object cache is responsible for holding resources such as scripts, stylesheets
+ * and images in memory.
+ *
+ * By default, the cache is enabled.
+ *
  * Disabling the cache will remove all resources from the cache.
  * They may still live on if they are referenced by some Web page though.
  *
  * @param set @c EINA_TRUE to enable memory cache, @c EINA_FALSE to disable
  */
-EAPI void             ewk_settings_cache_enable_set(Eina_Bool set);
+EAPI void             ewk_settings_object_cache_enable_set(Eina_Bool set);
 
 /**
- * Sets capacity of memory cache of WebCore.
+ * Defines the capacities for the in-memory object cache.
  *
- * WebCore sets default value of memory cache on 8192 * 1024 bytes.
+ * The object cache is responsible for holding resources such as scripts, stylesheets
+ * and images in memory.
  *
+ * By default, @p min_dead_bytes is 0 and both @p max_dead_bytes and @p total_bytes are 8MB.
+ *
+ * @param min_dead_bytes The maximum number of bytes that dead resources should consume when
+ *                       the cache is under pressure.
+ * @param max_dead_bytes The maximum number of bytes that dead resources should consume when
+ *                       the cache is not under pressure.
+ * @param total_bytes    The maximum number of bytes that the cache should consume overall.
+ *
  * @param capacity the maximum number of bytes that the cache should consume overall
  */
-EAPI void             ewk_settings_cache_capacity_set(unsigned capacity);
+EAPI void             ewk_settings_object_cache_capacity_set(unsigned min_dead_bytes, unsigned max_dead_bytes, unsigned total_bytes);
 
 /**
  * Clears all memory caches.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to