Changeset 142794 in webkit
- Timestamp:
- Feb 13, 2013 1:56:00 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r142792 r142794 1 2013-02-13 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 3 [EFL][WK2] Stop using WebString in ewk_cookie_manager, ewk_form_submission_request and ewk_text_checker 4 https://bugs.webkit.org/show_bug.cgi?id=108794 5 6 Reviewed by Alexey Proskuryakov. 7 8 Stop using WebString in ewk_cookie_manager, ewk_form_submission_request 9 and ewk_text_checker as it is internal C++ API. WKString and 10 WKEinaSharedString are used instead. 11 12 * UIProcess/API/cpp/efl/WKEinaSharedString.cpp: 13 (WKEinaSharedString::leakString): Add leakString() method to 14 WKEinaSharedString so that we can conveniently convert a WKString to a 15 Eina shared string and take ownership of it. 16 * UIProcess/API/cpp/efl/WKEinaSharedString.h: 17 * UIProcess/API/efl/ewk_cookie_manager.cpp: 18 (getHostnamesWithCookiesCallback): 19 * UIProcess/API/efl/ewk_form_submission_request.cpp: 20 (EwkFormSubmissionRequest::copyFieldValue): 21 (ewk_form_submission_request_field_names_get): 22 (ewk_form_submission_request_field_value_get): 23 * UIProcess/API/efl/ewk_form_submission_request_private.h: 24 (EwkFormSubmissionRequest): 25 * UIProcess/API/efl/ewk_text_checker.cpp: 26 (checkSpellingOfString): 27 (guessesForWord): 28 (learnWord): 29 (ignoreWord): 30 * UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp: 31 (TEST_F): Add API test for new WKEinaSharedString::leakString() method. 32 1 33 2013-02-13 Anders Carlsson <andersca@apple.com> 2 34 -
trunk/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp
r129319 r142794 113 113 return sharedString; 114 114 } 115 116 Eina_Stringshare* WKEinaSharedString::leakString() 117 { 118 Eina_Stringshare* sharedString = m_string; 119 m_string = 0; 120 121 return sharedString; 122 } -
trunk/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h
r128160 r142794 47 47 ~WKEinaSharedString(); 48 48 49 Eina_Stringshare* leakString(); 50 49 51 WKEinaSharedString& operator=(const WKEinaSharedString& other); 50 52 WKEinaSharedString& operator=(const char* str); -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp
r140542 r142794 35 35 #include "ewk_private.h" 36 36 #include <wtf/OwnPtr.h> 37 #include <wtf/text/CString.h>38 #include <wtf/text/WTFString.h>39 37 40 38 using namespace WebKit; … … 195 193 for (size_t i = 0; i < hostnameCount; ++i) { 196 194 WKStringRef wkHostname = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkHostnames, i)); 197 String hostname = toImpl(wkHostname)->string(); 198 if (hostname.isEmpty()) 195 if (WKStringIsEmpty(wkHostname)) 199 196 continue; 200 hostnames = eina_list_append(hostnames, eina_stringshare_add(hostname.utf8().data()));197 hostnames = eina_list_append(hostnames, WKEinaSharedString(wkHostname).leakString()); 201 198 } 202 199 -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.cpp
r133744 r142794 32 32 #include "WKString.h" 33 33 #include "ewk_form_submission_request_private.h" 34 #include <wtf/text/CString.h>35 34 36 35 using namespace WebKit; … … 49 48 } 50 49 51 String EwkFormSubmissionRequest::fieldValue(const String&fieldName) const50 Eina_Stringshare* EwkFormSubmissionRequest::copyFieldValue(const char* fieldName) const 52 51 { 53 52 ASSERT(fieldName); 54 WKRetainPtr<WKStringRef> wkFieldName = adoptWK( toCopiedAPI(fieldName));53 WKRetainPtr<WKStringRef> wkFieldName = adoptWK(WKStringCreateWithUTF8CString(fieldName)); 55 54 WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(m_wkValues.get(), wkFieldName.get())); 56 55 57 return wkValue ? toImpl(wkValue)->string() :String();56 return WKEinaSharedString(wkValue).leakString(); 58 57 } 59 58 … … 73 72 EWK_OBJ_GET_IMPL_OR_RETURN(EwkFormSubmissionRequest, request, impl, 0); 74 73 75 Eina_List* names = 0;74 Eina_List* fieldNames = 0; 76 75 77 WKRetainPtr<WKArrayRef> wk Keys = impl->fieldNames();78 const size_t numKeys = WKArrayGetSize(wk Keys.get());76 WKRetainPtr<WKArrayRef> wkFieldNames = impl->fieldNames(); 77 const size_t numKeys = WKArrayGetSize(wkFieldNames.get()); 79 78 for (size_t i = 0; i < numKeys; ++i) { 80 WKStringRef wk Key = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i));81 names = eina_list_append(names, eina_stringshare_add(toImpl(wkKey)->string().utf8().data()));79 WKStringRef wkFieldName = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkFieldNames.get(), i)); 80 fieldNames = eina_list_append(fieldNames, WKEinaSharedString(wkFieldName).leakString()); 82 81 } 83 82 84 return names;83 return fieldNames; 85 84 } 86 85 … … 90 89 EINA_SAFETY_ON_NULL_RETURN_VAL(name, 0); 91 90 92 String value = impl->fieldValue(String::fromUTF8(name)); 93 94 return value.isNull() ? 0 : eina_stringshare_add(value.utf8().data()); 91 return impl->copyFieldValue(name); 95 92 } 96 93 -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h
r135117 r142794 28 28 29 29 #include "WKDictionary.h" 30 #include "WKEinaSharedString.h" 30 31 #include "WKFormSubmissionListener.h" 31 32 #include "WKRetainPtr.h" 32 33 #include "ewk_object_private.h" 33 34 #include <wtf/PassRefPtr.h> 34 #include <wtf/text/WTFString.h>35 35 36 36 class EwkFormSubmissionRequest : public EwkObject { … … 46 46 47 47 WKRetainPtr<WKArrayRef> fieldNames() const; 48 String fieldValue(const String&fieldName) const;48 Eina_Stringshare* copyFieldValue(const char* fieldName) const; 49 49 50 50 void submit(); -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.cpp
r134021 r142794 32 32 #include "TextCheckerEnchant.h" 33 33 #include "WKAPICast.h" 34 #include "WKEinaSharedString.h" 34 35 #include "WKMutableArray.h" 35 36 #include "WKRetainPtr.h" … … 37 38 #include "WKTextChecker.h" 38 39 #include "WebPageProxy.h" 39 #include "WebString.h"40 40 #include "ewk_settings.h" 41 41 #include "ewk_text_checker_private.h" 42 42 #include <Eina.h> 43 43 #include <wtf/OwnPtr.h> 44 #include <wtf/text/CString.h>45 44 46 45 using namespace WebCore; … … 100 99 { 101 100 if (clientCallbacks().string_spelling_check) 102 clientCallbacks().string_spelling_check(tag, toImpl(text)->string().utf8().data(), misspellingLocation, misspellingLength);101 clientCallbacks().string_spelling_check(tag, WKEinaSharedString(text), misspellingLocation, misspellingLength); 103 102 else 104 textCheckerEnchant()->checkSpellingOfString(to Impl(text)->string(), *misspellingLocation, *misspellingLength);103 textCheckerEnchant()->checkSpellingOfString(toWTFString(text), *misspellingLocation, *misspellingLength); 105 104 } 106 105 … … 110 109 111 110 if (clientCallbacks().word_guesses_get) { 112 Eina_List* list = clientCallbacks().word_guesses_get(tag, toImpl(word)->string().utf8().data());111 Eina_List* list = clientCallbacks().word_guesses_get(tag, WKEinaSharedString(word)); 113 112 void* item; 114 113 … … 119 118 } 120 119 } else { 121 const Vector<String>& guesses = textCheckerEnchant()->getGuessesForWord(to Impl(word)->string());120 const Vector<String>& guesses = textCheckerEnchant()->getGuessesForWord(toWTFString(word)); 122 121 size_t numberOfGuesses = guesses.size(); 123 122 for (size_t i = 0; i < numberOfGuesses; ++i) { … … 133 132 { 134 133 if (clientCallbacks().word_learn) 135 clientCallbacks().word_learn(tag, toImpl(word)->string().utf8().data());134 clientCallbacks().word_learn(tag, WKEinaSharedString(word)); 136 135 else 137 textCheckerEnchant()->learnWord(to Impl(word)->string());136 textCheckerEnchant()->learnWord(toWTFString(word)); 138 137 } 139 138 … … 141 140 { 142 141 if (clientCallbacks().word_ignore) 143 clientCallbacks().word_ignore(tag, toImpl(word)->string().utf8().data());142 clientCallbacks().word_ignore(tag, WKEinaSharedString(word)); 144 143 else 145 textCheckerEnchant()->ignoreWord(to Impl(word)->string());144 textCheckerEnchant()->ignoreWord(toWTFString(word)); 146 145 } 147 146 -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp
r135349 r142794 125 125 checkString(string, anotherTestString); 126 126 } 127 128 TEST_F(EWK2UnitTestBase, leakString) 129 { 130 WKEinaSharedString string; 131 132 string = testString; 133 checkString(string, testString); 134 135 Eina_Stringshare* leakedString = string.leakString(); 136 checkString(string, 0); 137 ASSERT_STREQ(leakedString, testString); 138 139 eina_stringshare_del(leakedString); 140 }
Note: See TracChangeset
for help on using the changeset viewer.