[webkit-efl] RFC: Changes to the ewk_settings_cache_* API

Raphael Kubo da Costa kubo at profusion.mobi
Mon Nov 7 08:17:48 PST 2011


The ewk_settings_cache_* family of functions is quite messy right now.

Some calls deal with Offline Web Applications
(ewk_settings_cache_directory_path_{get,set}) and others deal with
in-memory cache settings (ewk_settings_cache_enable_{get,set} and
ewk_settings_cache_capacity_set).

I see the following issues with the current situation:

 1) Offline Web Applications are completely unrelated to the in-memory
    cache. The former handles the appcache part of the HTML5 spec,
    wheareas the latter just caches stylesheets, images and scripts in
    memory. Yet they both share the same function prefix. The current
    apidox also does not help at all (the term "offline web applications"
    is not even mentioned).

 2) The exposed API to control the memory cache is redundant and
    insufficient.

    - It is insufficient because one cannot pass all parameters accepted
      by MemoryCache::setCapacities(). It also does not clear other
      in-memory caches, such as the page and the font caches.

    - It is redundant because if the user could specify all the
      parameters accepted by MemoryCache::setCapacities() there would be
      no need to have the getter and setter for MemoryCache::disabled().

Please tell me what you think of the following proposal:

 - Rename ewk_settings_cache_directory_path_{get,set} to
   ewk_settings_offline_web_applications_cache_directory_{get,set}.

 - Follow more closely what the Qt API does and have:

   - ewk_settings_cache_clear(Ewk_Cache_Clear_Mode mode)
     Ewk_Cache_Clear_Mode is an enum which currently has only one value:

       enum Ewk_Cache_Clear_Mode { EWK_CACHE_CLEAR_MODE_MEMORY_CACHE };

     This one clears the memory cache, the page cache, the font cache
     and the cross-origin preflight cache, like Qt does.

     Once we have the necessary code to have a network disk-cache, we
     can add another item to the enum to make it possible to clear it as
     well.

   - ewk_settings_object_cache_capacity_set(minDeadBytes, maxDeadBytes,
     totalBytes)
     Pass the received parameters to MemoryCache::setCapacities(). If
     they are all 0, disable the in-memory object cache.

-- 
Raphael Kubo da Costa
ProFUSION embedded systems
http://profusion.mobi



More information about the webkit-efl mailing list