[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 14:12:57 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit f1364058ee9fc583e320cf67ff2c084e4e569d57
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 5 16:00:19 2010 +0000
2010-10-05 Ryuan Choi <ryuan.choi at samsung.com>
Reviewed by Antonio Gomes.
[EFL] Remove strdup in ewk_setting.cpp using eina_stringshare
https://bugs.webkit.org/show_bug.cgi?id=46613
Add variables shared by eina_stringshare and remove strdup.
* ewk/ewk_main.cpp:
(_ewk_init_body):
* ewk/ewk_settings.cpp:
(ewk_settings_web_database_path_set):
(ewk_settings_web_database_path_get):
(ewk_settings_icon_database_path_set):
(ewk_settings_icon_database_path_get):
* ewk/ewk_settings.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69113 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog
index 257219b..81d9a6a 100644
--- a/WebKit/efl/ChangeLog
+++ b/WebKit/efl/ChangeLog
@@ -1,3 +1,21 @@
+2010-10-05 Ryuan Choi <ryuan.choi at samsung.com>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Remove strdup in ewk_setting.cpp using eina_stringshare
+ https://bugs.webkit.org/show_bug.cgi?id=46613
+
+ Add variables shared by eina_stringshare and remove strdup.
+
+ * ewk/ewk_main.cpp:
+ (_ewk_init_body):
+ * ewk/ewk_settings.cpp:
+ (ewk_settings_web_database_path_set):
+ (ewk_settings_web_database_path_get):
+ (ewk_settings_icon_database_path_set):
+ (ewk_settings_icon_database_path_get):
+ * ewk/ewk_settings.h:
+
2010-10-04 Gyuyoung Kim <gyuyoung.kim at samsung.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/efl/ewk/ewk_main.cpp b/WebKit/efl/ewk/ewk_main.cpp
index 8c27478..26dec81 100644
--- a/WebKit/efl/ewk/ewk_main.cpp
+++ b/WebKit/efl/ewk/ewk_main.cpp
@@ -175,6 +175,7 @@ Eina_Bool _ewk_init_body(void)
WTF::String wkdir = WTF::String(home) + "/.webkit";
ewk_settings_web_database_path_set(wkdir.utf8().data());
+ ewk_settings_icon_database_path_set(wkdir.utf8().data());
WebCore::cacheStorage().setCacheDirectory(wkdir);
diff --git a/WebKit/efl/ewk/ewk_settings.cpp b/WebKit/efl/ewk/ewk_settings.cpp
index 6d2be05..f2651a1 100644
--- a/WebKit/efl/ewk/ewk_settings.cpp
+++ b/WebKit/efl/ewk/ewk_settings.cpp
@@ -44,6 +44,8 @@
#include <libsoup/soup.h>
#endif
+static const char* _ewk_default_web_database_path = 0;
+static const char* _ewk_icon_database_path = 0;
static uint64_t _ewk_default_web_database_quota = 1 * 1024 * 1024;
/**
@@ -69,21 +71,27 @@ void ewk_settings_web_database_path_set(const char *path)
#if ENABLE(DATABASE)
WTF::String corePath = WTF::String::fromUTF8(path);
WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(corePath);
+ if (!_ewk_default_web_database_path)
+ _ewk_default_web_database_path = eina_stringshare_add(corePath.utf8().data());
+ else
+ eina_stringshare_replace(&_ewk_default_web_database_path, corePath.utf8().data());
+
#endif
}
/**
* Return directory path where web database is stored.
*
- * @return newly allocated string with database path. Note that return must be
- * freed with free() as it's a strdup()ed copy of the string due reference
- * counting.
+ * @return database path or NULL if none or web database is not supported.
+ * This is guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
*/
const char *ewk_settings_web_database_path_get()
{
#if ENABLE(DATABASE)
- WTF::String path = WebCore::DatabaseTracker::tracker().databaseDirectoryPath();
- return strdup(path.utf8().data());
+ return _ewk_default_web_database_path;
#else
return 0;
#endif
@@ -122,9 +130,17 @@ Eina_Bool ewk_settings_icon_database_path_set(const char *directory)
WebCore::iconDatabase()->setEnabled(true);
WebCore::iconDatabase()->open(WTF::String::fromUTF8(directory));
+ if (!_ewk_icon_database_path)
+ _ewk_icon_database_path = eina_stringshare_add(directory);
+ else
+ eina_stringshare_replace(&_ewk_icon_database_path, directory);
} else {
WebCore::iconDatabase()->setEnabled(false);
WebCore::iconDatabase()->close();
+ if (_ewk_icon_database_path) {
+ eina_stringshare_del(_ewk_icon_database_path);
+ _ewk_icon_database_path = 0;
+ }
}
return EINA_TRUE;
}
@@ -132,22 +148,20 @@ Eina_Bool ewk_settings_icon_database_path_set(const char *directory)
/**
* Return directory path where icon database is stored.
*
- * @return newly allocated string with database path or @c NULL if
- * none is set or database is closed. Note that return must be
- * freed with free() as it's a strdup()ed copy of the string
- * due reference counting.
+ * @return database path or @c NULL if none is set or database is closed.
+ * This is guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
*/
-char* ewk_settings_icon_database_path_get(void)
+const char* ewk_settings_icon_database_path_get(void)
{
if (!WebCore::iconDatabase()->isEnabled())
return 0;
if (!WebCore::iconDatabase()->isOpen())
return 0;
- WTF::String path = WebCore::iconDatabase()->databasePath();
- if (path.isEmpty())
- return 0;
- return strdup(path.utf8().data());
+ return _ewk_icon_database_path;
}
/**
diff --git a/WebKit/efl/ewk/ewk_settings.h b/WebKit/efl/ewk/ewk_settings.h
index f2d77f7..3c1668f 100644
--- a/WebKit/efl/ewk/ewk_settings.h
+++ b/WebKit/efl/ewk/ewk_settings.h
@@ -42,7 +42,7 @@ EAPI void ewk_settings_web_database_path_set(const char *path);
EAPI const char *ewk_settings_web_database_path_get();
EAPI Eina_Bool ewk_settings_icon_database_path_set(const char *path);
-EAPI char *ewk_settings_icon_database_path_get(void);
+EAPI const char *ewk_settings_icon_database_path_get(void);
EAPI Eina_Bool ewk_settings_icon_database_clear(void);
EAPI cairo_surface_t *ewk_settings_icon_database_icon_surface_get(const char *url);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list