Changeset 69113 in webkit
- Timestamp:
- Oct 5, 2010 9:00:19 AM (13 years ago)
- Location:
- trunk/WebKit/efl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/efl/ChangeLog
r69061 r69113 1 2010-10-05 Ryuan Choi <ryuan.choi@samsung.com> 2 3 Reviewed by Antonio Gomes. 4 5 [EFL] Remove strdup in ewk_setting.cpp using eina_stringshare 6 https://bugs.webkit.org/show_bug.cgi?id=46613 7 8 Add variables shared by eina_stringshare and remove strdup. 9 10 * ewk/ewk_main.cpp: 11 (_ewk_init_body): 12 * ewk/ewk_settings.cpp: 13 (ewk_settings_web_database_path_set): 14 (ewk_settings_web_database_path_get): 15 (ewk_settings_icon_database_path_set): 16 (ewk_settings_icon_database_path_get): 17 * ewk/ewk_settings.h: 18 1 19 2010-10-04 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 20 -
trunk/WebKit/efl/ewk/ewk_main.cpp
r66377 r69113 176 176 WTF::String wkdir = WTF::String(home) + "/.webkit"; 177 177 ewk_settings_web_database_path_set(wkdir.utf8().data()); 178 ewk_settings_icon_database_path_set(wkdir.utf8().data()); 178 179 179 180 WebCore::cacheStorage().setCacheDirectory(wkdir); -
trunk/WebKit/efl/ewk/ewk_settings.cpp
r65021 r69113 45 45 #endif 46 46 47 static const char* _ewk_default_web_database_path = 0; 48 static const char* _ewk_icon_database_path = 0; 47 49 static uint64_t _ewk_default_web_database_quota = 1 * 1024 * 1024; 48 50 … … 70 72 WTF::String corePath = WTF::String::fromUTF8(path); 71 73 WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(corePath); 74 if (!_ewk_default_web_database_path) 75 _ewk_default_web_database_path = eina_stringshare_add(corePath.utf8().data()); 76 else 77 eina_stringshare_replace(&_ewk_default_web_database_path, corePath.utf8().data()); 78 72 79 #endif 73 80 } … … 76 83 * Return directory path where web database is stored. 77 84 * 78 * @return newly allocated string with database path. Note that return must be 79 * freed with free() as it's a strdup()ed copy of the string due reference 80 * counting. 85 * @return database path or NULL if none or web database is not supported. 86 * This is guaranteed to be eina_stringshare, so whenever possible 87 * save yourself some cpu cycles and use 88 * eina_stringshare_ref() instead of eina_stringshare_add() or 89 * strdup(). 81 90 */ 82 91 const char *ewk_settings_web_database_path_get() 83 92 { 84 93 #if ENABLE(DATABASE) 85 WTF::String path = WebCore::DatabaseTracker::tracker().databaseDirectoryPath(); 86 return strdup(path.utf8().data()); 94 return _ewk_default_web_database_path; 87 95 #else 88 96 return 0; … … 123 131 WebCore::iconDatabase()->setEnabled(true); 124 132 WebCore::iconDatabase()->open(WTF::String::fromUTF8(directory)); 133 if (!_ewk_icon_database_path) 134 _ewk_icon_database_path = eina_stringshare_add(directory); 135 else 136 eina_stringshare_replace(&_ewk_icon_database_path, directory); 125 137 } else { 126 138 WebCore::iconDatabase()->setEnabled(false); 127 139 WebCore::iconDatabase()->close(); 140 if (_ewk_icon_database_path) { 141 eina_stringshare_del(_ewk_icon_database_path); 142 _ewk_icon_database_path = 0; 143 } 128 144 } 129 145 return EINA_TRUE; … … 133 149 * Return directory path where icon database is stored. 134 150 * 135 * @return newly allocated string with database path or @c NULL if 136 * none is set or database is closed. Note that return must be 137 * freed with free() as it's a strdup()ed copy of the string 138 * due reference counting. 139 */ 140 char* ewk_settings_icon_database_path_get(void) 151 * @return database path or @c NULL if none is set or database is closed. 152 * This is guaranteed to be eina_stringshare, so whenever possible 153 * save yourself some cpu cycles and use 154 * eina_stringshare_ref() instead of eina_stringshare_add() or 155 * strdup(). 156 */ 157 const char* ewk_settings_icon_database_path_get(void) 141 158 { 142 159 if (!WebCore::iconDatabase()->isEnabled()) … … 145 162 return 0; 146 163 147 WTF::String path = WebCore::iconDatabase()->databasePath(); 148 if (path.isEmpty()) 149 return 0; 150 return strdup(path.utf8().data()); 164 return _ewk_icon_database_path; 151 165 } 152 166 -
trunk/WebKit/efl/ewk/ewk_settings.h
r63972 r69113 43 43 44 44 EAPI Eina_Bool ewk_settings_icon_database_path_set(const char *path); 45 EAPI c har*ewk_settings_icon_database_path_get(void);45 EAPI const char *ewk_settings_icon_database_path_get(void); 46 46 EAPI Eina_Bool ewk_settings_icon_database_clear(void); 47 47
Note: See TracChangeset
for help on using the changeset viewer.