Title: [125969] trunk/Source/WebKit2
Revision
125969
Author
[email protected]
Date
2012-08-18 14:47:06 -0700 (Sat, 18 Aug 2012)

Log Message

[EFL][WK2] ewk_back_forward_list_item properties should be in sync with WebProcessProxy::m_backForwardListItemMap
https://bugs.webkit.org/show_bug.cgi?id=94248

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

Currently ewk_back_forward_list_item properties are initialized from
WKBackForwardListItemRef once in the constructor and then just stored.
This is erroneous approach as back forward items can be initialized within
several iterations, meaning several ipc calls to UI process and several updates
of WebProcessProxy::m_backForwardListItemMap where the items are stored.
Hence the values of ewk_back_forward_list_item properties should be updated
with the corresponding WKBackForwardListItem function invokes every time
they are called.

* UIProcess/API/efl/ewk_back_forward_list_item.cpp:
(_Ewk_Back_Forward_List_Item): Data members have to be mutable as assigned being const pointers.
(_Ewk_Back_Forward_List_Item::_Ewk_Back_Forward_List_Item):
(ewk_back_forward_list_item_uri_get):
(ewk_back_forward_list_item_title_get):
(ewk_back_forward_list_item_original_uri_get):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (125968 => 125969)


--- trunk/Source/WebKit2/ChangeLog	2012-08-18 17:43:58 UTC (rev 125968)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-18 21:47:06 UTC (rev 125969)
@@ -1,3 +1,26 @@
+2012-08-18  Mikhail Pozdnyakov  <[email protected]>
+
+        [EFL][WK2] ewk_back_forward_list_item properties should be in sync with WebProcessProxy::m_backForwardListItemMap
+        https://bugs.webkit.org/show_bug.cgi?id=94248
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Currently ewk_back_forward_list_item properties are initialized from
+        WKBackForwardListItemRef once in the constructor and then just stored.
+        This is erroneous approach as back forward items can be initialized within
+        several iterations, meaning several ipc calls to UI process and several updates
+        of WebProcessProxy::m_backForwardListItemMap where the items are stored.
+        Hence the values of ewk_back_forward_list_item properties should be updated
+        with the corresponding WKBackForwardListItem function invokes every time
+        they are called.
+
+        * UIProcess/API/efl/ewk_back_forward_list_item.cpp:
+        (_Ewk_Back_Forward_List_Item): Data members have to be mutable as assigned being const pointers.
+        (_Ewk_Back_Forward_List_Item::_Ewk_Back_Forward_List_Item):
+        (ewk_back_forward_list_item_uri_get):
+        (ewk_back_forward_list_item_title_get):
+        (ewk_back_forward_list_item_original_uri_get):
+
 2012-08-17  Enrica Casucci  <[email protected]>
 
         Adding back the first statement of WebProcessMain accidentally

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp (125968 => 125969)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp	2012-08-18 17:43:58 UTC (rev 125968)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp	2012-08-18 21:47:06 UTC (rev 125969)
@@ -39,16 +39,13 @@
 struct _Ewk_Back_Forward_List_Item {
     unsigned int __ref; /**< the reference count of the object */
     WKRetainPtr<WKBackForwardListItemRef> wkItem;
-    WKEinaSharedString uri;
-    WKEinaSharedString title;
-    WKEinaSharedString originalUri;
+    mutable WKEinaSharedString uri;
+    mutable WKEinaSharedString title;
+    mutable WKEinaSharedString originalUri;
 
     _Ewk_Back_Forward_List_Item(WKBackForwardListItemRef itemRef)
         : __ref(1)
         , wkItem(itemRef)
-        , uri(AdoptWK, WKBackForwardListItemCopyURL(itemRef))
-        , title(AdoptWK, WKBackForwardListItemCopyTitle(itemRef))
-        , originalUri(AdoptWK, WKBackForwardListItemCopyOriginalURL(itemRef))
     { }
 
     ~_Ewk_Back_Forward_List_Item()
@@ -57,6 +54,17 @@
     }
 };
 
+#define EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem_, ...)    \
+    if (!(item)) {                                                         \
+        EINA_LOG_CRIT("item is NULL.");                                    \
+        return __VA_ARGS__;                                                \
+    }                                                                      \
+    if (!(item)->wkItem) {                                                 \
+        EINA_LOG_CRIT("item->wkItem is NULL.");                            \
+        return __VA_ARGS__;                                                \
+    }                                                                      \
+    WKBackForwardListItemRef wkItem_ = (item)->wkItem.get()
+
 void ewk_back_forward_list_item_ref(Ewk_Back_Forward_List_Item* item)
 {
     EINA_SAFETY_ON_NULL_RETURN(item);
@@ -75,22 +83,28 @@
 
 const char* ewk_back_forward_list_item_uri_get(const Ewk_Back_Forward_List_Item* item)
 {
-    EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+    EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0);
 
+    item->uri = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyURL(wkItem));
+
     return item->uri;
 }
 
 const char* ewk_back_forward_list_item_title_get(const Ewk_Back_Forward_List_Item* item)
 {
-    EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+    EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0);
 
+    item->title = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyTitle(wkItem));
+
     return item->title;
 }
 
 const char* ewk_back_forward_list_item_original_uri_get(const Ewk_Back_Forward_List_Item* item)
 {
-    EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+    EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0);
 
+    item->originalUri = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyOriginalURL(wkItem));
+
     return item->originalUri;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to