+2011-12-15 Raphael Kubo da Costa <kubo@profusion.mobi>
+
+ [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 <kubo@profusion.mobi>
[EFL] Add a few more web database functions to ewk_settings.
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()
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.
+ *
+ * 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.
*
- * WebCore sets default value of memory cache on 8192 * 1024 bytes.
+ * @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.