Title: [125671] trunk/Source/WebKit2
Revision
125671
Author
[email protected]
Date
2012-08-15 06:50:14 -0700 (Wed, 15 Aug 2012)

Log Message

[EFL][WK2] Refactoring: start using WKEinaSharedString in ewk_ classes
https://bugs.webkit.org/show_bug.cgi?id=93964

Patch by Mikhail Pozdnyakov <[email protected]> on 2012-08-15
Reviewed by Kenneth Rohde Christiansen.

Started using WKEinaSharedString where it is advisable.

* UIProcess/API/cpp/efl/WKEinaSharedString.cpp:
(WKEinaSharedString::operator==):
* UIProcess/API/cpp/efl/WKEinaSharedString.h:
* UIProcess/API/efl/ewk_download_job.cpp:
(_Ewk_Download_Job):
(_Ewk_Download_Job::_Ewk_Download_Job):
(_Ewk_Download_Job::~_Ewk_Download_Job):
(ewk_download_job_destination_set):
(ewk_download_job_suggested_filename_set):
* UIProcess/API/efl/ewk_intent.cpp:
(_Ewk_Intent):
(_Ewk_Intent::_Ewk_Intent):
(_Ewk_Intent::~_Ewk_Intent):
(ewk_intent_action_get):
(ewk_intent_type_get):
(ewk_intent_service_get):
* UIProcess/API/efl/ewk_intent_service.cpp:
(_Ewk_Intent_Service):
(_Ewk_Intent_Service::_Ewk_Intent_Service):
(_Ewk_Intent_Service::~_Ewk_Intent_Service):
(ewk_intent_service_action_get):
(ewk_intent_service_type_get):
(ewk_intent_service_href_get):
(ewk_intent_service_title_get):
(ewk_intent_service_disposition_get):
* UIProcess/API/efl/ewk_navigation_policy_decision.cpp:
(_Ewk_Navigation_Policy_Decision):
(_Ewk_Navigation_Policy_Decision::_Ewk_Navigation_Policy_Decision):
(_Ewk_Navigation_Policy_Decision::~_Ewk_Navigation_Policy_Decision):
* UIProcess/API/efl/ewk_url_request.cpp:
(_Ewk_Url_Request):
(_Ewk_Url_Request::_Ewk_Url_Request):
(_Ewk_Url_Request::~_Ewk_Url_Request):
(ewk_url_request_url_get):
(ewk_request_cookies_first_party_get):
(ewk_url_request_http_method_get):
* UIProcess/API/efl/ewk_url_response.cpp:
(_Ewk_Url_Response):
(_Ewk_Url_Response::_Ewk_Url_Response):
(_Ewk_Url_Response::~_Ewk_Url_Response):
(ewk_url_response_url_get):
(ewk_url_response_mime_type_get):
* UIProcess/API/efl/ewk_view.cpp:
(_Ewk_View_Private_Data):
(_Ewk_View_Private_Data::_Ewk_View_Private_Data):
(_Ewk_View_Private_Data::~_Ewk_View_Private_Data):
(ewk_view_uri_update):
(ewk_view_title_get):
(ewk_view_theme_set):
(ewk_view_setting_encoding_custom_get):
(ewk_view_setting_encoding_custom_set):
* UIProcess/API/efl/ewk_web_error.cpp:
(_Ewk_Web_Error):
(_Ewk_Web_Error::_Ewk_Web_Error):
(_Ewk_Web_Error::~_Ewk_Web_Error):
(ewk_web_error_url_get):
(ewk_web_error_description_get):
* UIProcess/API/efl/ewk_web_resource.cpp:
(_Ewk_Web_Resource):
(_Ewk_Web_Resource::_Ewk_Web_Resource):
(_Ewk_Web_Resource::~_Ewk_Web_Resource):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (125670 => 125671)


--- trunk/Source/WebKit2/ChangeLog	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-15 13:50:14 UTC (rev 125671)
@@ -1,3 +1,74 @@
+2012-08-15  Mikhail Pozdnyakov  <[email protected]>
+
+        [EFL][WK2] Refactoring: start using WKEinaSharedString in ewk_ classes
+        https://bugs.webkit.org/show_bug.cgi?id=93964
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Started using WKEinaSharedString where it is advisable.
+
+        * UIProcess/API/cpp/efl/WKEinaSharedString.cpp:
+        (WKEinaSharedString::operator==):
+        * UIProcess/API/cpp/efl/WKEinaSharedString.h:
+        * UIProcess/API/efl/ewk_download_job.cpp:
+        (_Ewk_Download_Job):
+        (_Ewk_Download_Job::_Ewk_Download_Job):
+        (_Ewk_Download_Job::~_Ewk_Download_Job):
+        (ewk_download_job_destination_set):
+        (ewk_download_job_suggested_filename_set):
+        * UIProcess/API/efl/ewk_intent.cpp:
+        (_Ewk_Intent):
+        (_Ewk_Intent::_Ewk_Intent):
+        (_Ewk_Intent::~_Ewk_Intent):
+        (ewk_intent_action_get):
+        (ewk_intent_type_get):
+        (ewk_intent_service_get):
+        * UIProcess/API/efl/ewk_intent_service.cpp:
+        (_Ewk_Intent_Service):
+        (_Ewk_Intent_Service::_Ewk_Intent_Service):
+        (_Ewk_Intent_Service::~_Ewk_Intent_Service):
+        (ewk_intent_service_action_get):
+        (ewk_intent_service_type_get):
+        (ewk_intent_service_href_get):
+        (ewk_intent_service_title_get):
+        (ewk_intent_service_disposition_get):
+        * UIProcess/API/efl/ewk_navigation_policy_decision.cpp:
+        (_Ewk_Navigation_Policy_Decision):
+        (_Ewk_Navigation_Policy_Decision::_Ewk_Navigation_Policy_Decision):
+        (_Ewk_Navigation_Policy_Decision::~_Ewk_Navigation_Policy_Decision):
+        * UIProcess/API/efl/ewk_url_request.cpp:
+        (_Ewk_Url_Request):
+        (_Ewk_Url_Request::_Ewk_Url_Request):
+        (_Ewk_Url_Request::~_Ewk_Url_Request):
+        (ewk_url_request_url_get):
+        (ewk_request_cookies_first_party_get):
+        (ewk_url_request_http_method_get):
+        * UIProcess/API/efl/ewk_url_response.cpp:
+        (_Ewk_Url_Response):
+        (_Ewk_Url_Response::_Ewk_Url_Response):
+        (_Ewk_Url_Response::~_Ewk_Url_Response):
+        (ewk_url_response_url_get):
+        (ewk_url_response_mime_type_get):
+        * UIProcess/API/efl/ewk_view.cpp:
+        (_Ewk_View_Private_Data):
+        (_Ewk_View_Private_Data::_Ewk_View_Private_Data):
+        (_Ewk_View_Private_Data::~_Ewk_View_Private_Data):
+        (ewk_view_uri_update):
+        (ewk_view_title_get):
+        (ewk_view_theme_set):
+        (ewk_view_setting_encoding_custom_get):
+        (ewk_view_setting_encoding_custom_set):
+        * UIProcess/API/efl/ewk_web_error.cpp:
+        (_Ewk_Web_Error):
+        (_Ewk_Web_Error::_Ewk_Web_Error):
+        (_Ewk_Web_Error::~_Ewk_Web_Error):
+        (ewk_web_error_url_get):
+        (ewk_web_error_description_get):
+        * UIProcess/API/efl/ewk_web_resource.cpp:
+        (_Ewk_Web_Resource):
+        (_Ewk_Web_Resource::_Ewk_Web_Resource):
+        (_Ewk_Web_Resource::~_Ewk_Web_Resource):
+
 2012-08-15  Christophe Dumez  <[email protected]>
 
         [WK2] Add support for Web Intents MessagePorts

Modified: trunk/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp	2012-08-15 13:50:14 UTC (rev 125671)
@@ -100,3 +100,8 @@
     eina_stringshare_replace(&m_string, str);
     return *this;
 }
+
+bool WKEinaSharedString::operator==(const char* str) const
+{
+    return (!str || !m_string) ? (str == m_string) : !strcmp(m_string, str);
+}

Modified: trunk/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h	2012-08-15 13:50:14 UTC (rev 125671)
@@ -52,6 +52,9 @@
     ALWAYS_INLINE bool operator==(const WKEinaSharedString& other) const { return this->m_string == other.m_string; }
     ALWAYS_INLINE bool operator!=(const WKEinaSharedString& other) const { return !(*this == other); }
 
+    bool operator==(const char* str) const;
+    ALWAYS_INLINE bool operator!=(const char* str) const { return !(*this == str); }
+
     ALWAYS_INLINE operator const char* () const { return m_string; }
 
     ALWAYS_INLINE bool isNull() const { return !m_string; }

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp	2012-08-15 13:50:14 UTC (rev 125671)
@@ -28,6 +28,7 @@
 
 #include "DownloadProxy.h"
 #include "WKAPICast.h"
+#include "WKEinaSharedString.h"
 #include "WKRetainPtr.h"
 #include "WebURLRequest.h"
 #include "ewk_download_job_private.h"
@@ -50,8 +51,8 @@
     double startTime;
     double endTime;
     uint64_t downloaded; /**< length already downloaded */
-    const char* destination;
-    const char* suggestedFilename;
+    WKEinaSharedString destination;
+    WKEinaSharedString suggestedFilename;
 
     _Ewk_Download_Job(DownloadProxy* download, Evas_Object* ewkView)
         : __ref(1)
@@ -63,8 +64,6 @@
         , startTime(-1)
         , endTime(-1)
         , downloaded(0)
-        , destination(0)
-        , suggestedFilename(0)
     { }
 
     ~_Ewk_Download_Job()
@@ -74,8 +73,6 @@
             ewk_url_request_unref(request);
         if (response)
             ewk_url_response_unref(response);
-        eina_stringshare_del(destination);
-        eina_stringshare_del(suggestedFilename);
     }
 };
 
@@ -159,7 +156,7 @@
     EINA_SAFETY_ON_NULL_RETURN_VAL(download, false);
     EINA_SAFETY_ON_NULL_RETURN_VAL(destination, false);
 
-    eina_stringshare_replace(&download->destination, destination);
+    download->destination = destination;
 
     return true;
 }
@@ -236,7 +233,7 @@
 {
     EINA_SAFETY_ON_NULL_RETURN(download);
 
-    eina_stringshare_replace(&download->suggestedFilename, suggestedFilename);
+    download->suggestedFilename = suggestedFilename;
 }
 
 /**

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp	2012-08-15 13:50:14 UTC (rev 125671)
@@ -29,6 +29,7 @@
 #include "WKAPICast.h"
 #include "WKArray.h"
 #include "WKDictionary.h"
+#include "WKEinaSharedString.h"
 #include "WKIntentData.h"
 #include "WKRetainPtr.h"
 #include "WKString.h"
@@ -47,26 +48,23 @@
 #if ENABLE(WEB_INTENTS)
     WKRetainPtr<WKIntentDataRef> wkIntent;
 #endif
-    const char* action;
-    const char* type;
-    const char* service;
+    WKEinaSharedString action;
+    WKEinaSharedString type;
+    WKEinaSharedString service;
 
     _Ewk_Intent(WKIntentDataRef intentRef)
         : __ref(1)
 #if ENABLE(WEB_INTENTS)
         , wkIntent(intentRef)
+        , action(AdoptWK, WKIntentDataCopyAction(intentRef))
+        , type(AdoptWK, WKIntentDataCopyType(intentRef))
+        , service(AdoptWK, WKIntentDataCopyService(intentRef))
 #endif
-        , action(0)
-        , type(0)
-        , service(0)
     { }
 
     ~_Ewk_Intent()
     {
         ASSERT(!__ref);
-        eina_stringshare_del(action);
-        eina_stringshare_del(type);
-        eina_stringshare_del(service);
     }
 };
 
@@ -103,47 +101,23 @@
 
 const char* ewk_intent_action_get(const Ewk_Intent* intent)
 {
-#if ENABLE(WEB_INTENTS)
-    EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0);
 
-    WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentDataCopyAction(wkIntent));
-    Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
-    eina_stringshare_replace(&ewkIntent->action, toImpl(wkAction.get())->string().utf8().data());
-
     return intent->action;
-#else
-    return 0;
-#endif
 }
 
 const char* ewk_intent_type_get(const Ewk_Intent* intent)
 {
-#if ENABLE(WEB_INTENTS)
-    EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0);
 
-    WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentDataCopyType(wkIntent));
-    Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
-    eina_stringshare_replace(&ewkIntent->type, toImpl(wkType.get())->string().utf8().data());
-
     return intent->type;
-#else
-    return 0;
-#endif
 }
 
 const char* ewk_intent_service_get(const Ewk_Intent* intent)
 {
-#if ENABLE(WEB_INTENTS)
-    EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0);
 
-    WKRetainPtr<WKURLRef> wkService(AdoptWK, WKIntentDataCopyService(wkIntent));
-    Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
-    eina_stringshare_replace(&ewkIntent->service, toImpl(wkService.get())->string().utf8().data());
-
     return intent->service;
-#else
-    return 0;
-#endif
 }
 
 Eina_List* ewk_intent_suggestions_get(const Ewk_Intent* intent)

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp	2012-08-15 13:50:14 UTC (rev 125671)
@@ -28,6 +28,7 @@
 
 #include "IntentServiceInfo.h"
 #include "WKAPICast.h"
+#include "WKEinaSharedString.h"
 #include "WKIntentServiceInfo.h"
 #include "WKRetainPtr.h"
 #include "WKURL.h"
@@ -42,49 +43,30 @@
  */
 struct _Ewk_Intent_Service {
     unsigned int __ref; /**< the reference count of the object */
-#if ENABLE(WEB_INTENTS_TAG)
-    WKRetainPtr<WKIntentServiceInfoRef> wkService;
-#endif
-    const char* action;
-    const char* type;
-    const char* href;
-    const char* title;
-    const char* disposition;
 
+    WKEinaSharedString action;
+    WKEinaSharedString type;
+    WKEinaSharedString href;
+    WKEinaSharedString title;
+    WKEinaSharedString disposition;
+
     _Ewk_Intent_Service(WKIntentServiceInfoRef serviceRef)
         : __ref(1)
 #if ENABLE(WEB_INTENTS_TAG)
-        , wkService(serviceRef)
+        , action(AdoptWK, WKIntentServiceInfoCopyAction(serviceRef))
+        , type(AdoptWK, WKIntentServiceInfoCopyType(serviceRef))
+        , href(AdoptWK, WKIntentServiceInfoCopyHref(serviceRef))
+        , title(AdoptWK, WKIntentServiceInfoCopyTitle(serviceRef))
+        , disposition(AdoptWK, WKIntentServiceInfoCopyDisposition(serviceRef))
 #endif
-        , action(0)
-        , type(0)
-        , href(0)
-        , title(0)
-        , disposition(0)
     { }
 
     ~_Ewk_Intent_Service()
     {
         ASSERT(!__ref);
-        eina_stringshare_del(action);
-        eina_stringshare_del(type);
-        eina_stringshare_del(href);
-        eina_stringshare_del(title);
-        eina_stringshare_del(disposition);
     }
 };
 
-#define EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService_, ...) \
-    if (!(service)) { \
-        EINA_LOG_CRIT("service is NULL."); \
-        return __VA_ARGS__; \
-    } \
-    if (!(service)->wkService) { \
-        EINA_LOG_CRIT("service->wkService is NULL."); \
-        return __VA_ARGS__; \
-    } \
-    WKIntentServiceInfoRef wkService_ = (service)->wkService.get()
-
 void ewk_intent_service_ref(Ewk_Intent_Service* service)
 {
 #if ENABLE(WEB_INTENTS_TAG)
@@ -107,77 +89,37 @@
 
 const char* ewk_intent_service_action_get(const Ewk_Intent_Service* service)
 {
-#if ENABLE(WEB_INTENTS_TAG)
-    EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
 
-    WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentServiceInfoCopyAction(wkService));
-    Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
-    eina_stringshare_replace(&ewkIntentService->action, toImpl(wkAction.get())->string().utf8().data());
-
     return service->action;
-#else
-    return 0;
-#endif
 }
 
 const char* ewk_intent_service_type_get(const Ewk_Intent_Service* service)
 {
-#if ENABLE(WEB_INTENTS_TAG)
-    EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
 
-    WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentServiceInfoCopyType(wkService));
-    Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
-    eina_stringshare_replace(&ewkIntentService->type, toImpl(wkType.get())->string().utf8().data());
-
     return service->type;
-#else
-    return 0;
-#endif
 }
 
 const char* ewk_intent_service_href_get(const Ewk_Intent_Service* service)
 {
-#if ENABLE(WEB_INTENTS_TAG)
-    EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
 
-    WKRetainPtr<WKURLRef> wkHref(AdoptWK, WKIntentServiceInfoCopyHref(wkService));
-    Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
-    eina_stringshare_replace(&ewkIntentService->href, toImpl(wkHref.get())->string().utf8().data());
-
     return service->href;
-#else
-    return 0;
-#endif
 }
 
 const char* ewk_intent_service_title_get(const Ewk_Intent_Service* service)
 {
-#if ENABLE(WEB_INTENTS_TAG)
-    EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
 
-    WKRetainPtr<WKStringRef> wkTitle(AdoptWK, WKIntentServiceInfoCopyTitle(wkService));
-    Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
-    eina_stringshare_replace(&ewkIntentService->title, toImpl(wkTitle.get())->string().utf8().data());
-
     return service->title;
-#else
-    return 0;
-#endif
 }
 
 const char* ewk_intent_service_disposition_get(const Ewk_Intent_Service* service)
 {
-#if ENABLE(WEB_INTENTS_TAG)
-    EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
 
-    WKRetainPtr<WKStringRef> wkDisposition(AdoptWK, WKIntentServiceInfoCopyDisposition(wkService));
-    Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
-    eina_stringshare_replace(&ewkIntentService->disposition, toImpl(wkDisposition.get())->string().utf8().data());
-
     return service->disposition;
-#else
-    return 0;
-#endif
 }
 
 #if ENABLE(WEB_INTENTS_TAG)

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp	2012-08-15 13:50:14 UTC (rev 125671)
@@ -27,6 +27,7 @@
 #include "ewk_navigation_policy_decision.h"
 
 #include "WKAPICast.h"
+#include "WKEinaSharedString.h"
 #include "WKFramePolicyListener.h"
 #include "WKRetainPtr.h"
 #include "ewk_navigation_policy_decision_private.h"
@@ -47,7 +48,7 @@
     Event_Mouse_Button mouseButton;
     Event_Modifier_Keys modifiers;
     Ewk_Url_Request* request;
-    const char* frameName;
+    WKEinaSharedString frameName;
 
     _Ewk_Navigation_Policy_Decision(WKFramePolicyListenerRef _listener, Ewk_Navigation_Type _navigationType, Event_Mouse_Button _mouseButton, Event_Modifier_Keys _modifiers, Ewk_Url_Request* _request, const char* _frameName)
         : __ref(1)
@@ -57,7 +58,7 @@
         , mouseButton(_mouseButton)
         , modifiers(_modifiers)
         , request(_request)
-        , frameName(eina_stringshare_add(_frameName))
+        , frameName(_frameName)
     { }
 
     ~_Ewk_Navigation_Policy_Decision()
@@ -69,7 +70,6 @@
             WKFramePolicyListenerUse(listener.get());
 
         ewk_url_request_unref(request);
-        eina_stringshare_del(frameName);
     }
 };
 

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp	2012-08-15 13:50:14 UTC (rev 125671)
@@ -27,7 +27,7 @@
 #include "ewk_url_request.h"
 
 #include "WKAPICast.h"
-#include "WKRetainPtr.h"
+#include "WKEinaSharedString.h"
 #include "WKURL.h"
 #include "WKURLRequest.h"
 #include "WebURLRequest.h"
@@ -42,40 +42,24 @@
  */
 struct _Ewk_Url_Request {
     unsigned int __ref; /**< the reference count of the object */
-    WKRetainPtr<WKURLRequestRef> wkRequest;
 
-    const char* url;
-    const char* first_party;
-    const char* http_method;
+    WKEinaSharedString url;
+    WKEinaSharedString first_party;
+    WKEinaSharedString http_method;
 
     _Ewk_Url_Request(WKURLRequestRef requestRef)
         : __ref(1)
-        , wkRequest(requestRef)
-        , url(0)
-        , first_party(0)
-        , http_method(0)
+        , url(AdoptWK, WKURLRequestCopyURL(requestRef))
+        , first_party(AdoptWK, WKURLRequestCopyFirstPartyForCookies(requestRef))
+        , http_method(AdoptWK, WKURLRequestCopyHTTPMethod(requestRef))
     { }
 
     ~_Ewk_Url_Request()
     {
         ASSERT(!__ref);
-        eina_stringshare_del(url);
-        eina_stringshare_del(first_party);
-        eina_stringshare_del(http_method);
     }
 };
 
-#define EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest_, ...)    \
-    if (!(request)) {                                                 \
-        EINA_LOG_CRIT("request is NULL.");                            \
-        return __VA_ARGS__;                                           \
-    }                                                                 \
-    if (!(request)->wkRequest) {                                      \
-        EINA_LOG_CRIT("request->wkRequest is NULL.");                 \
-        return __VA_ARGS__;                                           \
-    }                                                                 \
-    WKURLRequestRef wkRequest_ = (request)->wkRequest.get()
-
 void ewk_url_request_ref(Ewk_Url_Request* request)
 {
     EINA_SAFETY_ON_NULL_RETURN(request);
@@ -94,32 +78,22 @@
 
 const char* ewk_url_request_url_get(const Ewk_Url_Request* request)
 {
-    EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
 
-    WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest));
-    Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
-    eina_stringshare_replace(&ewkRequest->url, toImpl(wkUrl.get())->string().utf8().data());
-
     return request->url;
 }
 
 const char* ewk_request_cookies_first_party_get(const Ewk_Url_Request* request)
 {
-    EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
 
-    Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
-    eina_stringshare_replace(&ewkRequest->first_party, toImpl(wkRequest)->resourceRequest().firstPartyForCookies().string().utf8().data());
-
     return request->first_party;
 }
 
 const char* ewk_url_request_http_method_get(const Ewk_Url_Request* request)
 {
-    EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0);
 
-    Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
-    eina_stringshare_replace(&ewkRequest->http_method, toImpl(wkRequest)->resourceRequest().httpMethod().utf8().data());
-
     return request->http_method;
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp	2012-08-15 13:50:14 UTC (rev 125671)
@@ -26,9 +26,14 @@
 #include "config.h"
 #include "ewk_url_response.h"
 
+#include "WKAPICast.h"
+#include "WKEinaSharedString.h"
+#include "WKURLResponse.h"
 #include "ewk_url_response_private.h"
 #include <wtf/text/CString.h>
 
+using namespace WebKit;
+
 /**
  * \struct  _Ewk_Url_Response
  * @brief   Contains the URL response data.
@@ -37,21 +42,19 @@
     unsigned int __ref; /**< the reference count of the object */
     WebCore::ResourceResponse coreResponse;
 
-    const char* url;
-    const char* mimeType;
+    WKEinaSharedString url;
+    WKEinaSharedString mimeType;
 
     _Ewk_Url_Response(const WebCore::ResourceResponse& _coreResponse)
         : __ref(1)
         , coreResponse(_coreResponse)
-        , url(0)
-        , mimeType(0)
+        , url(AdoptWK, WKURLResponseCopyURL(toAPI(coreResponse)))
+        , mimeType(AdoptWK, WKURLResponseCopyMIMEType(toAPI(coreResponse)))
     { }
 
     ~_Ewk_Url_Response()
     {
         ASSERT(!__ref);
-        eina_stringshare_del(url);
-        eina_stringshare_del(mimeType);
     }
 };
 
@@ -75,9 +78,6 @@
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0);
 
-    Ewk_Url_Response* ewkResponse = const_cast<Ewk_Url_Response*>(response);
-    eina_stringshare_replace(&ewkResponse->url, response->coreResponse.url().string().utf8().data());
-
     return response->url;
 }
 
@@ -92,9 +92,6 @@
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0);
 
-    Ewk_Url_Response* ewkResponse = const_cast<Ewk_Url_Response*>(response);
-    eina_stringshare_replace(&ewkResponse->mimeType, response->coreResponse.mimeType().utf8().data());
-
     return response->mimeType;
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-08-15 13:50:14 UTC (rev 125671)
@@ -26,6 +26,7 @@
 #include "NativeWebWheelEvent.h"
 #include "PageClientImpl.h"
 #include "WKAPICast.h"
+#include "WKEinaSharedString.h"
 #include "WKFindOptions.h"
 #include "WKRetainPtr.h"
 #include "WKString.h"
@@ -73,11 +74,11 @@
     OwnPtr<EflViewportHandler> viewportHandler;
 #endif
 
-    const char* uri;
-    const char* title;
-    const char* theme;
-    const char* customEncoding;
-    const char* cursorGroup;
+    WKEinaSharedString uri;
+    WKEinaSharedString title;
+    WKEinaSharedString theme;
+    WKEinaSharedString customEncoding;
+    WKEinaSharedString cursorGroup;
     Evas_Object* cursorObject;
     LoadingResourcesMap loadingResourcesMap;
     Ewk_Back_Forward_List* backForwardList;
@@ -93,12 +94,7 @@
 #endif
 
     _Ewk_View_Private_Data()
-        : uri(0)
-        , title(0)
-        , theme(0)
-        , customEncoding(0)
-        , cursorGroup(0)
-        , cursorObject(0)
+        : cursorObject(0)
         , backForwardList(0)
 #ifdef HAVE_ECORE_X
         , isUsingEcoreX(false)
@@ -112,10 +108,6 @@
 
     ~_Ewk_View_Private_Data()
     {
-        eina_stringshare_del(uri);
-        eina_stringshare_del(title);
-        eina_stringshare_del(theme);
-        eina_stringshare_del(customEncoding);
         _ewk_view_priv_loading_resources_clear(loadingResourcesMap);
 
         if (cursorObject)
@@ -771,10 +763,12 @@
     if (activeURL.isEmpty())
         return;
 
-    if (!eina_stringshare_replace(&priv->uri, activeURL.utf8().data()))
+    if (priv->uri == activeURL.utf8().data())
         return;
 
-    evas_object_smart_callback_call(ewkView, "uri,changed", static_cast<void*>(const_cast<char*>(priv->uri)));
+    priv->uri = activeURL.utf8().data();
+    const char* callbackArgument = static_cast<const char*>(priv->uri);
+    evas_object_smart_callback_call(ewkView, "uri,changed", const_cast<char*>(callbackArgument));
 }
 
 Eina_Bool ewk_view_uri_set(Evas_Object* ewkView, const char* uri)
@@ -933,7 +927,7 @@
     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
 
     CString title = priv->pageClient->page()->pageTitle().utf8();
-    eina_stringshare_replace(&priv->title, title.data());
+    priv->title = title.data();
 
     return priv->title;
 }
@@ -1032,10 +1026,10 @@
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
 
-    if (!eina_stringshare_replace(&priv->theme, path))
-        return;
-
-    priv->pageClient->page()->setThemePath(path);
+    if (priv->theme != path) {
+        priv->theme = path;
+        priv->pageClient->page()->setThemePath(path);
+    }
 }
 
 const char* ewk_view_theme_get(const Evas_Object* ewkView)
@@ -1381,7 +1375,7 @@
     if (customEncoding.isEmpty())
         return 0;
 
-    eina_stringshare_replace(&priv->customEncoding, customEncoding.utf8().data());
+    priv->customEncoding = customEncoding.utf8().data();
 
     return priv->customEncoding;
 }
@@ -1391,8 +1385,8 @@
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
 
-    if (eina_stringshare_replace(&priv->customEncoding, encoding))
-        priv->pageClient->page()->setCustomTextEncodingName(encoding ? encoding : String());
+    priv->customEncoding = encoding;
+    priv->pageClient->page()->setCustomTextEncodingName(encoding ? encoding : String());
 
     return true;
 }

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp	2012-08-15 13:50:14 UTC (rev 125671)
@@ -27,6 +27,7 @@
 #include "ewk_web_error.h"
 
 #include "ErrorsEfl.h"
+#include "WKEinaSharedString.h"
 #include "WKString.h"
 #include "WKURL.h"
 #include "ewk_web_error_private.h"
@@ -41,19 +42,17 @@
 struct _Ewk_Web_Error {
     WKRetainPtr<WKErrorRef> wkError;
 
-    const char* url;
-    const char* description;
+    WKEinaSharedString url;
+    WKEinaSharedString description;
 
     _Ewk_Web_Error(WKErrorRef errorRef)
         : wkError(errorRef)
-        , url(0)
-        , description(0)
+        , url(AdoptWK, WKErrorCopyFailingURL(errorRef))
+        , description(AdoptWK, WKErrorCopyLocalizedDescription(errorRef))
     { }
 
     ~_Ewk_Web_Error()
     {
-        eina_stringshare_del(url);
-        eina_stringshare_del(description);
     }
 };
 
@@ -97,12 +96,8 @@
 
 const char* ewk_web_error_url_get(const Ewk_Web_Error* error)
 {
-    EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0);
 
-    WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKErrorCopyFailingURL(wkError));
-    Ewk_Web_Error* ewkError = const_cast<Ewk_Web_Error*>(error);
-    eina_stringshare_replace(&ewkError->url, toImpl(wkUrl.get())->string().utf8().data());
-
     return error->url;
 }
 
@@ -115,12 +110,8 @@
 
 const char* ewk_web_error_description_get(const Ewk_Web_Error* error)
 {
-    EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0);
 
-    WKRetainPtr<WKStringRef> wkDescription(AdoptWK, WKErrorCopyLocalizedDescription(wkError));
-    Ewk_Web_Error* ewkError = const_cast<Ewk_Web_Error*>(error);
-    eina_stringshare_replace(&ewkError->description, toImpl(wkDescription.get())->string().utf8().data());
-
     return error->description;
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp (125670 => 125671)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp	2012-08-15 13:03:19 UTC (rev 125670)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp	2012-08-15 13:50:14 UTC (rev 125671)
@@ -26,24 +26,24 @@
 #include "config.h"
 #include "ewk_web_resource.h"
 
+#include "WKEinaSharedString.h"
 #include "ewk_web_resource_private.h"
 #include <wtf/text/CString.h>
 
 struct _Ewk_Web_Resource {
     unsigned int __ref; /**< the reference count of the object */
-    const char* url;
+    WKEinaSharedString url;
     bool isMainResource;
 
-    _Ewk_Web_Resource(const char* _url, bool _isMainResource)
+    _Ewk_Web_Resource(const char* url, bool isMainResource)
         : __ref(1)
-         , url(eina_stringshare_add(_url))
-        , isMainResource(_isMainResource)
+        , url(url)
+        , isMainResource(isMainResource)
     { }
 
     ~_Ewk_Web_Resource()
     {
         ASSERT(!__ref);
-        eina_stringshare_del(url);
     }
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to