Title: [122697] trunk/Source/WebKit2
Revision
122697
Author
[email protected]
Date
2012-07-15 23:25:16 -0700 (Sun, 15 Jul 2012)

Log Message

[EFL][WK2] Define destructors for Ewk structures
https://bugs.webkit.org/show_bug.cgi?id=91338

Patch by Christophe Dumez <[email protected]> on 2012-07-15
Reviewed by Kentaro Hara.

Add destructors to Ewk structures and move
memory freeing code from *_free() or *_unref()
functions to the destructors.

* UIProcess/API/efl/ewk_intent.cpp:
(_Ewk_Intent::_Ewk_Intent):
(_Ewk_Intent):
(_Ewk_Intent::~_Ewk_Intent):
(ewk_intent_unref):
* UIProcess/API/efl/ewk_intent_service.cpp:
(_Ewk_Intent_Service):
(_Ewk_Intent_Service::~_Ewk_Intent_Service):
(ewk_intent_service_unref):
* UIProcess/API/efl/ewk_navigation_policy_decision.cpp:
(_Ewk_Navigation_Policy_Decision):
(_Ewk_Navigation_Policy_Decision::~_Ewk_Navigation_Policy_Decision):
(ewk_navigation_policy_decision_free):
* UIProcess/API/efl/ewk_url_request.cpp:
(_Ewk_Url_Request):
(_Ewk_Url_Request::~_Ewk_Url_Request):
(ewk_url_request_unref):
* UIProcess/API/efl/ewk_url_response.cpp:
(_Ewk_Url_Response):
(_Ewk_Url_Response::~_Ewk_Url_Response):
(ewk_url_response_unref):
* UIProcess/API/efl/ewk_view.cpp:
(_Ewk_View_Private_Data):
(_Ewk_View_Private_Data::~_Ewk_View_Private_Data):
(_ewk_view_priv_del):
* UIProcess/API/efl/ewk_web_error.cpp:
(_Ewk_Web_Error):
(_Ewk_Web_Error::~_Ewk_Web_Error):
(ewk_web_error_free):
* UIProcess/API/efl/ewk_web_resource.cpp:
(_Ewk_Web_Resource):
(_Ewk_Web_Resource::~_Ewk_Web_Resource):
(ewk_web_resource_unref):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (122696 => 122697)


--- trunk/Source/WebKit2/ChangeLog	2012-07-16 06:22:58 UTC (rev 122696)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-16 06:25:16 UTC (rev 122697)
@@ -1,3 +1,48 @@
+2012-07-15  Christophe Dumez  <[email protected]>
+
+        [EFL][WK2] Define destructors for Ewk structures
+        https://bugs.webkit.org/show_bug.cgi?id=91338
+
+        Reviewed by Kentaro Hara.
+
+        Add destructors to Ewk structures and move
+        memory freeing code from *_free() or *_unref()
+        functions to the destructors.
+
+        * UIProcess/API/efl/ewk_intent.cpp:
+        (_Ewk_Intent::_Ewk_Intent):
+        (_Ewk_Intent):
+        (_Ewk_Intent::~_Ewk_Intent):
+        (ewk_intent_unref):
+        * UIProcess/API/efl/ewk_intent_service.cpp:
+        (_Ewk_Intent_Service):
+        (_Ewk_Intent_Service::~_Ewk_Intent_Service):
+        (ewk_intent_service_unref):
+        * UIProcess/API/efl/ewk_navigation_policy_decision.cpp:
+        (_Ewk_Navigation_Policy_Decision):
+        (_Ewk_Navigation_Policy_Decision::~_Ewk_Navigation_Policy_Decision):
+        (ewk_navigation_policy_decision_free):
+        * UIProcess/API/efl/ewk_url_request.cpp:
+        (_Ewk_Url_Request):
+        (_Ewk_Url_Request::~_Ewk_Url_Request):
+        (ewk_url_request_unref):
+        * UIProcess/API/efl/ewk_url_response.cpp:
+        (_Ewk_Url_Response):
+        (_Ewk_Url_Response::~_Ewk_Url_Response):
+        (ewk_url_response_unref):
+        * UIProcess/API/efl/ewk_view.cpp:
+        (_Ewk_View_Private_Data):
+        (_Ewk_View_Private_Data::~_Ewk_View_Private_Data):
+        (_ewk_view_priv_del):
+        * UIProcess/API/efl/ewk_web_error.cpp:
+        (_Ewk_Web_Error):
+        (_Ewk_Web_Error::~_Ewk_Web_Error):
+        (ewk_web_error_free):
+        * UIProcess/API/efl/ewk_web_resource.cpp:
+        (_Ewk_Web_Resource):
+        (_Ewk_Web_Resource::~_Ewk_Web_Resource):
+        (ewk_web_resource_unref):
+
 2012-07-14  Eric Carlson  <[email protected]>
 
         Enable AVCF hardware video decoding

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


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp	2012-07-16 06:22:58 UTC (rev 122696)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp	2012-07-16 06:25:16 UTC (rev 122697)
@@ -59,7 +59,14 @@
         , action(0)
         , type(0)
         , service(0)
+    { }
+
+    ~_Ewk_Intent()
     {
+        ASSERT(!__ref);
+        eina_stringshare_del(action);
+        eina_stringshare_del(type);
+        eina_stringshare_del(service);
     }
 };
 
@@ -90,9 +97,6 @@
     if (--intent->__ref)
         return;
 
-    eina_stringshare_del(intent->action);
-    eina_stringshare_del(intent->type);
-    eina_stringshare_del(intent->service);
     delete intent;
 #endif
 }

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


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp	2012-07-16 06:22:58 UTC (rev 122696)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp	2012-07-16 06:25:16 UTC (rev 122697)
@@ -62,6 +62,16 @@
         , 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_, ...) \
@@ -91,11 +101,6 @@
     if (--service->__ref)
         return;
 
-    eina_stringshare_del(service->action);
-    eina_stringshare_del(service->type);
-    eina_stringshare_del(service->href);
-    eina_stringshare_del(service->title);
-    eina_stringshare_del(service->disposition);
     delete service;
 #endif
 }

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


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp	2012-07-16 06:22:58 UTC (rev 122696)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp	2012-07-16 06:25:16 UTC (rev 122697)
@@ -57,18 +57,22 @@
         , request(_request)
         , frameName(eina_stringshare_add(_frameName))
     { }
+
+    ~_Ewk_Navigation_Policy_Decision()
+    {
+        // This is the default choice for all policy decisions in WebPageProxy.cpp.
+        if (!actedUponByClient)
+            WKFramePolicyListenerUse(listener.get());
+
+        ewk_url_request_unref(request);
+        eina_stringshare_del(frameName);
+    }
 };
 
 void ewk_navigation_policy_decision_free(Ewk_Navigation_Policy_Decision* decision)
 {
     EINA_SAFETY_ON_NULL_RETURN(decision);
 
-    // This is the default choice for all policy decisions in WebPageProxy.cpp.
-    if (!decision->actedUponByClient)
-        WKFramePolicyListenerUse(decision->listener.get());
-
-    ewk_url_request_unref(decision->request);
-    eina_stringshare_del(decision->frameName);
     delete decision;
 }
 

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


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp	2012-07-16 06:22:58 UTC (rev 122696)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp	2012-07-16 06:25:16 UTC (rev 122697)
@@ -56,6 +56,14 @@
         , first_party(0)
         , http_method(0)
     { }
+
+    ~_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_, ...)    \
@@ -82,9 +90,6 @@
     if (--request->__ref)
         return;
 
-    eina_stringshare_del(request->url);
-    eina_stringshare_del(request->first_party);
-    eina_stringshare_del(request->http_method);
     delete request;
 }
 

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


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp	2012-07-16 06:22:58 UTC (rev 122696)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp	2012-07-16 06:25:16 UTC (rev 122697)
@@ -46,6 +46,13 @@
         , url(0)
         , mimeType(0)
     { }
+
+    ~_Ewk_Url_Response()
+    {
+        ASSERT(!__ref);
+        eina_stringshare_del(url);
+        eina_stringshare_del(mimeType);
+    }
 };
 
 void ewk_url_response_ref(Ewk_Url_Response* response)
@@ -61,8 +68,6 @@
     if (--response->__ref)
         return;
 
-    eina_stringshare_del(response->url);
-    eina_stringshare_del(response->mimeType);
     delete response;
 }
 

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


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-07-16 06:22:58 UTC (rev 122696)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-07-16 06:25:16 UTC (rev 122697)
@@ -55,6 +55,12 @@
         : uri(0)
         , title(0)
     { }
+
+    ~_Ewk_View_Private_Data()
+    {
+        eina_stringshare_del(uri);
+        eina_stringshare_del(title);
+    }
 };
 
 #define EWK_VIEW_TYPE_CHECK(ewkView, result)                                   \
@@ -276,12 +282,6 @@
 
 static void _ewk_view_priv_del(Ewk_View_Private_Data* priv)
 {
-    if (!priv)
-        return;
-
-    priv->pageClient = nullptr;
-    eina_stringshare_del(priv->uri);
-    eina_stringshare_del(priv->title);
     delete priv;
 }
 

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


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp	2012-07-16 06:22:58 UTC (rev 122696)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp	2012-07-16 06:25:16 UTC (rev 122697)
@@ -50,6 +50,12 @@
         , url(0)
         , description(0)
     { }
+
+    ~_Ewk_Web_Error()
+    {
+        eina_stringshare_del(url);
+        eina_stringshare_del(description);
+    }
 };
 
 #define EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError_, ...)    \
@@ -63,12 +69,10 @@
     }                                                          \
     WKErrorRef wkError_ = (error)->wkError.get()
 
-void ewk_web_error_free(Ewk_Web_Error *error)
+void ewk_web_error_free(Ewk_Web_Error* error)
 {
     EINA_SAFETY_ON_NULL_RETURN(error);
 
-    eina_stringshare_del(error->url);
-    eina_stringshare_del(error->description);
     delete error;
 }
 

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


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp	2012-07-16 06:22:58 UTC (rev 122696)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp	2012-07-16 06:25:16 UTC (rev 122697)
@@ -39,6 +39,12 @@
          , url(eina_stringshare_add(_url))
         , isMainResource(_isMainResource)
     { }
+
+    ~_Ewk_Web_Resource()
+    {
+        ASSERT(!__ref);
+        eina_stringshare_del(url);
+    }
 };
 
 void ewk_web_resource_ref(Ewk_Web_Resource* resource)
@@ -55,7 +61,6 @@
     if (--resource->__ref)
         return;
 
-    eina_stringshare_del(resource->url);
     delete resource;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to