Changeset 107260 in webkit


Ignore:
Timestamp:
Feb 9, 2012 10:38:06 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[EFL] Introducing functions to set local storage db path and clear
those dbs.
https://bugs.webkit.org/show_bug.cgi?id=77107

This patch exposes the web local storage tracker database path
setting cabability, introduced on bug 77006, to the EFL port of
WebKit. Particularly, we have our own storage tracker client
object, to initialize the storage tracker backend on ewk_init().

Patch by Gustavo Lima Chaves <glima@profusion.mobi> on 2012-02-09
Reviewed by Kenneth Rohde Christiansen.

  • CMakeListsEfl.txt:
  • WebCoreSupport/StorageTrackerClientEfl.cpp: Added.

(WebCore):
(WebCore::StorageTrackerClientEfl::dispatchDidModifyOrigin):
(WebCore::StorageTrackerClientEfl::didFinishLoadingOrigins):

  • WebCoreSupport/StorageTrackerClientEfl.h: Added.

(WebCore):
(StorageTrackerClientEfl):

  • ewk/ewk_main.cpp:

(trackerClient):
(_ewk_init_body):

  • ewk/ewk_settings.cpp:

(ewk_settings_local_storage_path_set):
(ewk_settings_local_storage_path_get):
(ewk_settings_local_storage_database_clear):
(ewk_settings_local_storage_database_origin_clear):

  • ewk/ewk_settings.h:
Location:
trunk/Source/WebKit/efl
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/efl/CMakeListsEfl.txt

    r104960 r107260  
    7474    efl/WebCoreSupport/FullscreenVideoControllerEfl.cpp
    7575    efl/WebCoreSupport/IconDatabaseClientEfl.cpp
     76    efl/WebCoreSupport/StorageTrackerClientEfl.cpp
    7677    efl/WebCoreSupport/InspectorClientEfl.cpp
    7778    efl/WebCoreSupport/NotificationPresenterClientEfl.cpp
  • trunk/Source/WebKit/efl/ChangeLog

    r107010 r107260  
     12012-02-09  Gustavo Lima Chaves  <glima@profusion.mobi>
     2
     3        [EFL] Introducing functions to set local storage db path and clear
     4        those dbs.
     5        https://bugs.webkit.org/show_bug.cgi?id=77107
     6
     7        This patch exposes the web local storage tracker database path
     8        setting cabability, introduced on bug 77006, to the EFL port of
     9        WebKit. Particularly, we have our own storage tracker client
     10        object, to initialize the storage tracker backend on ewk_init().
     11
     12        Reviewed by Kenneth Rohde Christiansen.
     13
     14        * CMakeListsEfl.txt:
     15        * WebCoreSupport/StorageTrackerClientEfl.cpp: Added.
     16        (WebCore):
     17        (WebCore::StorageTrackerClientEfl::dispatchDidModifyOrigin):
     18        (WebCore::StorageTrackerClientEfl::didFinishLoadingOrigins):
     19        * WebCoreSupport/StorageTrackerClientEfl.h: Added.
     20        (WebCore):
     21        (StorageTrackerClientEfl):
     22        * ewk/ewk_main.cpp:
     23        (trackerClient):
     24        (_ewk_init_body):
     25        * ewk/ewk_settings.cpp:
     26        (ewk_settings_local_storage_path_set):
     27        (ewk_settings_local_storage_path_get):
     28        (ewk_settings_local_storage_database_clear):
     29        (ewk_settings_local_storage_database_origin_clear):
     30        * ewk/ewk_settings.h:
     31
    1322012-02-07  Krzysztof Czech  <k.czech@samsung.com>
    233
  • trunk/Source/WebKit/efl/ewk/ewk_main.cpp

    r106760 r107260  
    2828#include "ScriptController.h"
    2929#include "Settings.h"
     30#include "StorageTracker.h"
     31#include "StorageTrackerClientEfl.h"
    3032#include "ewk_logging.h"
    3133#include "ewk_network.h"
     
    136138}
    137139
     140static WebCore::StorageTrackerClientEfl* trackerClient()
     141{
     142    DEFINE_STATIC_LOCAL(WebCore::StorageTrackerClientEfl, trackerClient, ());
     143    return &trackerClient;
     144}
     145
    138146Eina_Bool _ewk_init_body(void)
    139147{
     
    175183    ewk_network_tls_certificate_check_set(false);
    176184
     185    WebCore::StorageTracker::initializeTracker(webkitDirectory.utf8().data(), trackerClient());
     186
    177187    // TODO: this should move to WebCore, already reported to webkit-gtk folks:
    178188#if USE(SOUP)
  • trunk/Source/WebKit/efl/ewk/ewk_settings.cpp

    r102971 r107260  
    2525#include "CrossOriginPreflightResultCache.h"
    2626#include "DatabaseTracker.h"
     27#include "StorageTracker.h"
    2728#include "FontCache.h"
    2829#include "FrameView.h"
     
    5859
    5960static const char* s_webDatabasePath = 0;
     61static const char* s_localStoragePath = 0;
    6062static uint64_t s_webDatabaseQuota = 1 * 1024 * 1024; // 1MB.
    6163
     
    112114}
    113115
     116void ewk_settings_local_storage_path_set(const char* path)
     117{
     118    WebCore::StorageTracker::tracker().setDatabaseDirectoryPath(WTF::String::fromUTF8(path));
     119    eina_stringshare_replace(&s_localStoragePath, path);
     120}
     121
     122const char* ewk_settings_local_storage_path_get(void)
     123{
     124    return s_localStoragePath;
     125}
     126
     127void ewk_settings_local_storage_database_clear()
     128{
     129    WebCore::StorageTracker::tracker().deleteAllOrigins();
     130}
     131
     132void ewk_settings_local_storage_database_origin_clear(const char* url)
     133{
     134    EINA_SAFETY_ON_NULL_RETURN(url);
     135
     136    const WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url));
     137    WebCore::StorageTracker::tracker().deleteOrigin(WebCore::SecurityOrigin::create(kurl).get());
     138}
     139
    114140void ewk_settings_web_database_path_set(const char* path)
    115141{
  • trunk/Source/WebKit/efl/ewk/ewk_settings.h

    r102971 r107260  
    6767 */
    6868EAPI void             ewk_settings_web_database_path_set(const char *path);
     69
     70/**
     71 * Sets the current path to the directory where WebKit will write the
     72 * HTML5 local storage indexing database (the one keeping track of
     73 * individual views' local storage databases).
     74 *
     75 * By default, the value is @c ~/.webkit
     76 *
     77 * @param path the new local storage database directory path
     78 *
     79 * @note You may want to call
     80 * ewk_view_setting_local_storage_database_path_set() on the same @p
     81 * path, here, for your views.
     82 */
     83EAPI void ewk_settings_local_storage_path_set(const char* path);
     84
     85/**
     86 * Returns directory's path where the HTML5 local storage indexing
     87 * database is stored.
     88 *
     89 * This is guaranteed to be eina-stringshared, so whenever possible
     90 * save yourself some cpu cycles and use eina_stringshare_ref()
     91 * instead of eina_stringshare_add() or strdup().
     92 *
     93 * @return database path or @c NULL, on errors.
     94 *
     95 * @see ewk_settings_local_storage_path_set()
     96 */
     97EAPI const char* ewk_settings_local_storage_path_get(void);
     98
     99/**
     100 * Removes @b all HTML 5 local storage databases.
     101 */
     102EAPI void ewk_settings_local_storage_database_clear();
     103
     104/**
     105 * Clears the HTML 5 local storage database for the given URL
     106 * (origin).
     107 *
     108 * @param url which URL to clear local storage to.
     109 *
     110 * After this call, the file holding the local storage database for
     111 * that origin will be deleted, along with its entry on the local
     112 * storage files database (a file stored under the path returned by
     113 * ewk_settings_local_storage_path_get()).
     114 */
     115EAPI void ewk_settings_local_storage_database_origin_clear(const char *url);
    69116
    70117/**
Note: See TracChangeset for help on using the changeset viewer.