Title: [237184] trunk/Source
Revision
237184
Author
[email protected]
Date
2018-10-16 08:58:10 -0700 (Tue, 16 Oct 2018)

Log Message

Replace HistoryItem* with HistoryItem& where possible
https://bugs.webkit.org/show_bug.cgi?id=190617

Reviewed by Chris Dumez.

Source/WebCore:

* history/BackForwardClient.h:
* history/BackForwardController.cpp:
(WebCore::BackForwardController::setCurrentItem):
* history/BackForwardController.h:
* history/HistoryItem.cpp:
(WebCore::defaultNotifyHistoryItemChanged):
(WebCore::HistoryItem::setAlternateTitle):
(WebCore::HistoryItem::setURLString):
(WebCore::HistoryItem::setOriginalURLString):
(WebCore::HistoryItem::setReferrer):
(WebCore::HistoryItem::setTitle):
(WebCore::HistoryItem::setTarget):
(WebCore::HistoryItem::setShouldRestoreScrollPosition):
(WebCore::HistoryItem::setStateObject):
(WebCore::HistoryItem::notifyChanged):
* history/HistoryItem.h:
* loader/EmptyClients.cpp:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
(WebCore::FrameLoader::loadSameDocumentItem):
* loader/HistoryController.cpp:
(WebCore::HistoryController::goToItem):
(WebCore::HistoryController::updateForCommit):
(WebCore::HistoryController::recursiveUpdateForCommit):
(WebCore::HistoryController::recursiveUpdateForSameDocumentNavigation):
(WebCore::HistoryController::setCurrentItem):
(WebCore::HistoryController::createItem):
(WebCore::HistoryController::itemsAreClones const):
(WebCore::HistoryController::currentFramesMatchItem const):
* loader/HistoryController.h:

Source/WebKit:

* WebProcess/WebCoreSupport/SessionStateConversion.h:
* WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::WK2NotifyHistoryItemChanged):
(WebKit::WebBackForwardListProxy::goToItem):
* WebProcess/WebPage/WebBackForwardListProxy.h:

Source/WebKitLegacy/mac:

* History/BackForwardList.h:
* History/BackForwardList.mm:
(BackForwardList::goToItem):
* History/WebBackForwardList.mm:
(-[WebBackForwardList goToItem:]):
* History/WebHistoryItem.mm:
(WKNotifyHistoryItemChanged):
* History/WebHistoryItemInternal.h:

Source/WebKitLegacy/win:

* BackForwardList.cpp:
(BackForwardList::goToItem):
* BackForwardList.h:
* WebBackForwardList.cpp:
(WebBackForwardList::goToItem):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237183 => 237184)


--- trunk/Source/WebCore/ChangeLog	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebCore/ChangeLog	2018-10-16 15:58:10 UTC (rev 237184)
@@ -1,5 +1,44 @@
 2018-10-16  Alex Christensen  <[email protected]>
 
+        Replace HistoryItem* with HistoryItem& where possible
+        https://bugs.webkit.org/show_bug.cgi?id=190617
+
+        Reviewed by Chris Dumez.
+
+        * history/BackForwardClient.h:
+        * history/BackForwardController.cpp:
+        (WebCore::BackForwardController::setCurrentItem):
+        * history/BackForwardController.h:
+        * history/HistoryItem.cpp:
+        (WebCore::defaultNotifyHistoryItemChanged):
+        (WebCore::HistoryItem::setAlternateTitle):
+        (WebCore::HistoryItem::setURLString):
+        (WebCore::HistoryItem::setOriginalURLString):
+        (WebCore::HistoryItem::setReferrer):
+        (WebCore::HistoryItem::setTitle):
+        (WebCore::HistoryItem::setTarget):
+        (WebCore::HistoryItem::setShouldRestoreScrollPosition):
+        (WebCore::HistoryItem::setStateObject):
+        (WebCore::HistoryItem::notifyChanged):
+        * history/HistoryItem.h:
+        * loader/EmptyClients.cpp:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
+        (WebCore::FrameLoader::loadSameDocumentItem):
+        * loader/HistoryController.cpp:
+        (WebCore::HistoryController::goToItem):
+        (WebCore::HistoryController::updateForCommit):
+        (WebCore::HistoryController::recursiveUpdateForCommit):
+        (WebCore::HistoryController::recursiveUpdateForSameDocumentNavigation):
+        (WebCore::HistoryController::setCurrentItem):
+        (WebCore::HistoryController::createItem):
+        (WebCore::HistoryController::itemsAreClones const):
+        (WebCore::HistoryController::currentFramesMatchItem const):
+        * loader/HistoryController.h:
+
+2018-10-16  Alex Christensen  <[email protected]>
+
         Remove unused WebHistoryItem._transientPropertyForKey
         https://bugs.webkit.org/show_bug.cgi?id=190606
 

Modified: trunk/Source/WebCore/history/BackForwardClient.h (237183 => 237184)


--- trunk/Source/WebCore/history/BackForwardClient.h	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebCore/history/BackForwardClient.h	2018-10-16 15:58:10 UTC (rev 237184)
@@ -42,7 +42,7 @@
 
     virtual void addItem(Ref<HistoryItem>&&) = 0;
 
-    virtual void goToItem(HistoryItem*) = 0;
+    virtual void goToItem(HistoryItem&) = 0;
         
     virtual HistoryItem* itemAtIndex(int) = 0;
     virtual int backListCount() const = 0;

Modified: trunk/Source/WebCore/history/BackForwardController.cpp (237183 => 237184)


--- trunk/Source/WebCore/history/BackForwardController.cpp	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebCore/history/BackForwardController.cpp	2018-10-16 15:58:10 UTC (rev 237184)
@@ -98,7 +98,7 @@
     m_client->addItem(WTFMove(item));
 }
 
-void BackForwardController::setCurrentItem(HistoryItem* item)
+void BackForwardController::setCurrentItem(HistoryItem& item)
 {
     m_client->goToItem(item);
 }

Modified: trunk/Source/WebCore/history/BackForwardController.h (237183 => 237184)


--- trunk/Source/WebCore/history/BackForwardController.h	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebCore/history/BackForwardController.h	2018-10-16 15:58:10 UTC (rev 237184)
@@ -51,7 +51,7 @@
     WEBCORE_EXPORT bool goForward();
 
     void addItem(Ref<HistoryItem>&&);
-    void setCurrentItem(HistoryItem*);
+    void setCurrentItem(HistoryItem&);
         
     int count() const;
     WEBCORE_EXPORT int backCount() const;

Modified: trunk/Source/WebCore/history/HistoryItem.cpp (237183 => 237184)


--- trunk/Source/WebCore/history/HistoryItem.cpp	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebCore/history/HistoryItem.cpp	2018-10-16 15:58:10 UTC (rev 237184)
@@ -49,11 +49,11 @@
     return ++next;
 }
 
-static void defaultNotifyHistoryItemChanged(HistoryItem*)
+static void defaultNotifyHistoryItemChanged(HistoryItem&)
 {
 }
 
-WEBCORE_EXPORT void (*notifyHistoryItemChanged)(HistoryItem*) = defaultNotifyHistoryItemChanged;
+void (*notifyHistoryItemChanged)(HistoryItem&) = defaultNotifyHistoryItemChanged;
 
 HistoryItem::HistoryItem()
     : HistoryItem({ }, { })
@@ -195,13 +195,13 @@
 void HistoryItem::setAlternateTitle(const String& alternateTitle)
 {
     m_displayTitle = alternateTitle;
-    notifyHistoryItemChanged(this);
+    notifyChanged();
 }
 
 void HistoryItem::setURLString(const String& urlString)
 {
     m_urlString = urlString;
-    notifyHistoryItemChanged(this);
+    notifyChanged();
 }
 
 void HistoryItem::setURL(const URL& url)
@@ -214,25 +214,25 @@
 void HistoryItem::setOriginalURLString(const String& urlString)
 {
     m_originalURLString = urlString;
-    notifyHistoryItemChanged(this);
+    notifyChanged();
 }
 
 void HistoryItem::setReferrer(const String& referrer)
 {
     m_referrer = referrer;
-    notifyHistoryItemChanged(this);
+    notifyChanged();
 }
 
 void HistoryItem::setTitle(const String& title)
 {
     m_title = title;
-    notifyHistoryItemChanged(this);
+    notifyChanged();
 }
 
 void HistoryItem::setTarget(const String& target)
 {
     m_target = target;
-    notifyHistoryItemChanged(this);
+    notifyChanged();
 }
 
 const IntPoint& HistoryItem::scrollPosition() const
@@ -258,7 +258,7 @@
 void HistoryItem::setShouldRestoreScrollPosition(bool shouldRestore)
 {
     m_shouldRestoreScrollPosition = shouldRestore;
-    notifyHistoryItemChanged(this);
+    notifyChanged();
 }
 
 float HistoryItem::pageScaleFactor() const
@@ -309,7 +309,7 @@
 void HistoryItem::setStateObject(RefPtr<SerializedScriptValue>&& object)
 {
     m_stateObject = WTFMove(object);
-    notifyHistoryItemChanged(this);
+    notifyChanged();
 }
 
 void HistoryItem::addChildItem(Ref<HistoryItem>&& child)
@@ -465,7 +465,7 @@
 
 void HistoryItem::notifyChanged()
 {
-    notifyHistoryItemChanged(this);
+    notifyHistoryItemChanged(*this);
 }
 
 #ifndef NDEBUG

Modified: trunk/Source/WebCore/history/HistoryItem.h (237183 => 237184)


--- trunk/Source/WebCore/history/HistoryItem.h	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebCore/history/HistoryItem.h	2018-10-16 15:58:10 UTC (rev 237184)
@@ -57,7 +57,7 @@
 class URL;
 enum class PruningReason;
 
-WEBCORE_EXPORT extern void (*notifyHistoryItemChanged)(HistoryItem*);
+WEBCORE_EXPORT extern void (*notifyHistoryItemChanged)(HistoryItem&);
 
 class HistoryItem : public RefCounted<HistoryItem> {
     friend class PageCache;

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (237183 => 237184)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2018-10-16 15:58:10 UTC (rev 237184)
@@ -83,7 +83,7 @@
 
 class EmptyBackForwardClient final : public BackForwardClient {
     void addItem(Ref<HistoryItem>&&) final { }
-    void goToItem(HistoryItem*) final { }
+    void goToItem(HistoryItem&) final { }
     HistoryItem* itemAtIndex(int) final { return nullptr; }
     int backListCount() const final { return 0; }
     int forwardListCount() const final { return 0; }

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (237183 => 237184)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2018-10-16 15:58:10 UTC (rev 237184)
@@ -2436,7 +2436,7 @@
             }
             if (shouldReset && item)
                 if (Page* page = m_frame.page()) {
-                    page->backForward().setCurrentItem(item.get());
+                    page->backForward().setCurrentItem(*item);
                 }
             return;
         }
@@ -3301,7 +3301,7 @@
         if ((isTargetItem || m_frame.isMainFrame()) && isBackForwardLoadType(policyChecker().loadType())) {
             if (Page* page = m_frame.page()) {
                 if (HistoryItem* resetItem = m_frame.mainFrame().loader().history().currentItem())
-                    page->backForward().setCurrentItem(resetItem);
+                    page->backForward().setCurrentItem(*resetItem);
             }
         }
         return;
@@ -3561,7 +3561,7 @@
     if (FrameView* view = m_frame.view())
         view->setWasScrolledByUser(false);
 
-    history().setCurrentItem(&item);
+    history().setCurrentItem(item);
         
     // loadInSameDocument() actually changes the URL and notifies load delegates of a "fake" load
     loadInSameDocument(item.url(), item.stateObject(), false);

Modified: trunk/Source/WebCore/loader/HistoryController.cpp (237183 => 237184)


--- trunk/Source/WebCore/loader/HistoryController.cpp	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebCore/loader/HistoryController.cpp	2018-10-16 15:58:10 UTC (rev 237184)
@@ -316,7 +316,7 @@
     // - plus, it only makes sense for the top level of the operation through the frame tree,
     // as opposed to happening for some/one of the page commits that might happen soon
     RefPtr<HistoryItem> currentItem = page->backForward().currentItem();
-    page->backForward().setCurrentItem(&targetItem);
+    page->backForward().setCurrentItem(targetItem);
 
     // First set the provisional item of any frames that are not actually navigating.
     // This must be done before trying to navigate the desired frame, because some
@@ -484,7 +484,8 @@
         // Not having one leads to us not having a m_currentItem later, which is also a terrible known issue.
         // We should get to the bottom of this.
         ASSERT(m_provisionalItem);
-        setCurrentItem(m_provisionalItem.get());
+        if (m_provisionalItem)
+            setCurrentItem(*m_provisionalItem.get());
         m_provisionalItem = nullptr;
 
         // Tell all other frames in the tree to commit their provisional items and
@@ -525,7 +526,8 @@
             view->setWasScrolledByUser(false);
 
         // Now commit the provisional item
-        setCurrentItem(m_provisionalItem.get());
+        if (m_provisionalItem)
+            setCurrentItem(*m_provisionalItem.get());
         m_provisionalItem = nullptr;
 
         // Restore form state (works from currentItem)
@@ -574,7 +576,8 @@
         return;
 
     // Commit the provisional item.
-    setCurrentItem(m_provisionalItem.get());
+    if (m_provisionalItem)
+        setCurrentItem(*m_provisionalItem.get());
     m_provisionalItem = nullptr;
 
     // Iterate over the rest of the tree.
@@ -590,11 +593,11 @@
     m_frameLoadComplete = true;
 }
 
-void HistoryController::setCurrentItem(HistoryItem* item)
+void HistoryController::setCurrentItem(HistoryItem& item)
 {
     m_frameLoadComplete = false;
     m_previousItem = m_currentItem;
-    m_currentItem = item;
+    m_currentItem = &item;
 }
 
 void HistoryController::setCurrentItemTitle(const StringWithDirection& title)
@@ -676,7 +679,7 @@
     initializeItem(item);
     
     // Set the item for which we will save document state
-    setCurrentItem(item.ptr());
+    setCurrentItem(item);
     
     return item;
 }
@@ -775,17 +778,17 @@
     return item2
         && &item1 != item2
         && item1.itemSequenceNumber() == item2->itemSequenceNumber()
-        && currentFramesMatchItem(&item1)
+        && currentFramesMatchItem(item1)
         && item2->hasSameFrames(item1);
 }
 
 // Helper method that determines whether the current frame tree matches given history item's.
-bool HistoryController::currentFramesMatchItem(HistoryItem* item) const
+bool HistoryController::currentFramesMatchItem(HistoryItem& item) const
 {
-    if ((!m_frame.tree().uniqueName().isEmpty() || !item->target().isEmpty()) && m_frame.tree().uniqueName() != item->target())
+    if ((!m_frame.tree().uniqueName().isEmpty() || !item.target().isEmpty()) && m_frame.tree().uniqueName() != item.target())
         return false;
-        
-    const auto& childItems = item->children();
+
+    const auto& childItems = item.children();
     if (childItems.size() != m_frame.tree().childCount())
         return false;
     

Modified: trunk/Source/WebCore/loader/HistoryController.h (237183 => 237184)


--- trunk/Source/WebCore/loader/HistoryController.h	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebCore/loader/HistoryController.h	2018-10-16 15:58:10 UTC (rev 237184)
@@ -75,7 +75,7 @@
     void updateForFrameLoadCompleted();
 
     HistoryItem* currentItem() const { return m_currentItem.get(); }
-    void setCurrentItem(HistoryItem*);
+    void setCurrentItem(HistoryItem&);
     void setCurrentItemTitle(const StringWithDirection&);
     bool currentItemShouldBeReplaced() const;
     WEBCORE_EXPORT void replaceCurrentItem(HistoryItem*);
@@ -107,7 +107,7 @@
     void recursiveUpdateForCommit();
     void recursiveUpdateForSameDocumentNavigation();
     bool itemsAreClones(HistoryItem&, HistoryItem*) const;
-    bool currentFramesMatchItem(HistoryItem*) const;
+    bool currentFramesMatchItem(HistoryItem&) const;
     void updateBackForwardListClippedAtTarget(bool doClip);
     void updateCurrentItem();
 

Modified: trunk/Source/WebKit/ChangeLog (237183 => 237184)


--- trunk/Source/WebKit/ChangeLog	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKit/ChangeLog	2018-10-16 15:58:10 UTC (rev 237184)
@@ -1,3 +1,16 @@
+2018-10-16  Alex Christensen  <[email protected]>
+
+        Replace HistoryItem* with HistoryItem& where possible
+        https://bugs.webkit.org/show_bug.cgi?id=190617
+
+        Reviewed by Chris Dumez.
+
+        * WebProcess/WebCoreSupport/SessionStateConversion.h:
+        * WebProcess/WebPage/WebBackForwardListProxy.cpp:
+        (WebKit::WK2NotifyHistoryItemChanged):
+        (WebKit::WebBackForwardListProxy::goToItem):
+        * WebProcess/WebPage/WebBackForwardListProxy.h:
+
 2018-10-16  Philippe Normand  <[email protected]>
 
         Unreviewed, another GTK build fix after r237146

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.h (237183 => 237184)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.h	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.h	2018-10-16 15:58:10 UTC (rev 237184)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef SessionStateConversion_h
-#define SessionStateConversion_h
+#pragma once
 
 #include <wtf/Forward.h>
 
@@ -35,11 +34,8 @@
 namespace WebKit {
 
 struct BackForwardListItemState;
-struct PageState;
 
 BackForwardListItemState toBackForwardListItemState(const WebCore::HistoryItem&);
 Ref<WebCore::HistoryItem> toHistoryItem(const BackForwardListItemState&);
 
 } // namespace WebKit
-
-#endif // SessionStateConversion_h

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp (237183 => 237184)


--- trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp	2018-10-16 15:58:10 UTC (rev 237184)
@@ -62,9 +62,9 @@
     idToHistoryItemMap().set(itemID, item.ptr());
 }
 
-static void WK2NotifyHistoryItemChanged(HistoryItem* item)
+static void WK2NotifyHistoryItemChanged(HistoryItem& item)
 {
-    WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::UpdateBackForwardItem(toBackForwardListItemState(*item)), 0);
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::UpdateBackForwardItem(toBackForwardListItemState(item)), 0);
 }
 
 HistoryItem* WebBackForwardListProxy::itemForID(const BackForwardItemIdentifier& itemID)
@@ -100,13 +100,13 @@
     m_page->send(Messages::WebPageProxy::BackForwardAddItem(toBackForwardListItemState(item.get())));
 }
 
-void WebBackForwardListProxy::goToItem(HistoryItem* item)
+void WebBackForwardListProxy::goToItem(HistoryItem& item)
 {
     if (!m_page)
         return;
 
     SandboxExtension::Handle sandboxExtensionHandle;
-    m_page->sendSync(Messages::WebPageProxy::BackForwardGoToItem(item->identifier()), Messages::WebPageProxy::BackForwardGoToItem::Reply(sandboxExtensionHandle));
+    m_page->sendSync(Messages::WebPageProxy::BackForwardGoToItem(item.identifier()), Messages::WebPageProxy::BackForwardGoToItem::Reply(sandboxExtensionHandle));
     m_page->sandboxExtensionTracker().beginLoad(m_page->mainWebFrame(), WTFMove(sandboxExtensionHandle));
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h (237183 => 237184)


--- trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h	2018-10-16 15:58:10 UTC (rev 237184)
@@ -56,7 +56,7 @@
 
     void addItem(Ref<WebCore::HistoryItem>&&) override;
 
-    void goToItem(WebCore::HistoryItem*) override;
+    void goToItem(WebCore::HistoryItem&) override;
         
     WebCore::HistoryItem* itemAtIndex(int) override;
     int backListCount() const override;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (237183 => 237184)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-10-16 15:58:10 UTC (rev 237184)
@@ -1,5 +1,21 @@
 2018-10-16  Alex Christensen  <[email protected]>
 
+        Replace HistoryItem* with HistoryItem& where possible
+        https://bugs.webkit.org/show_bug.cgi?id=190617
+
+        Reviewed by Chris Dumez.
+
+        * History/BackForwardList.h:
+        * History/BackForwardList.mm:
+        (BackForwardList::goToItem):
+        * History/WebBackForwardList.mm:
+        (-[WebBackForwardList goToItem:]):
+        * History/WebHistoryItem.mm:
+        (WKNotifyHistoryItemChanged):
+        * History/WebHistoryItemInternal.h:
+
+2018-10-16  Alex Christensen  <[email protected]>
+
         Remove unused WebHistoryItem._transientPropertyForKey
         https://bugs.webkit.org/show_bug.cgi?id=190606
 

Modified: trunk/Source/WebKitLegacy/mac/History/BackForwardList.h (237183 => 237184)


--- trunk/Source/WebKitLegacy/mac/History/BackForwardList.h	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKitLegacy/mac/History/BackForwardList.h	2018-10-16 15:58:10 UTC (rev 237184)
@@ -45,7 +45,7 @@
     void addItem(Ref<WebCore::HistoryItem>&&) override;
     void goBack();
     void goForward();
-    void goToItem(WebCore::HistoryItem*) override;
+    void goToItem(WebCore::HistoryItem&) override;
         
     WebCore::HistoryItem* backItem();
     WebCore::HistoryItem* currentItem();

Modified: trunk/Source/WebKitLegacy/mac/History/BackForwardList.mm (237183 => 237184)


--- trunk/Source/WebKitLegacy/mac/History/BackForwardList.mm	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKitLegacy/mac/History/BackForwardList.mm	2018-10-16 15:58:10 UTC (rev 237184)
@@ -91,14 +91,14 @@
         m_current++;
 }
 
-void BackForwardList::goToItem(HistoryItem* item)
+void BackForwardList::goToItem(HistoryItem& item)
 {
-    if (!m_entries.size() || !item)
+    if (!m_entries.size())
         return;
-        
+
     unsigned index = 0;
     for (; index < m_entries.size(); ++index) {
-        if (m_entries[index].ptr() == item)
+        if (m_entries[index].ptr() == &item)
             break;
     }
 

Modified: trunk/Source/WebKitLegacy/mac/History/WebBackForwardList.mm (237183 => 237184)


--- trunk/Source/WebKitLegacy/mac/History/WebBackForwardList.mm	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKitLegacy/mac/History/WebBackForwardList.mm	2018-10-16 15:58:10 UTC (rev 237184)
@@ -219,7 +219,8 @@
 
 - (void)goToItem:(WebHistoryItem *)item
 {
-    core(self)->goToItem(core(item));
+    if (item)
+        core(self)->goToItem(*core(item));
 }
 
 - (WebHistoryItem *)backItem

Modified: trunk/Source/WebKitLegacy/mac/History/WebHistoryItem.mm (237183 => 237184)


--- trunk/Source/WebKitLegacy/mac/History/WebHistoryItem.mm	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKitLegacy/mac/History/WebHistoryItem.mm	2018-10-16 15:58:10 UTC (rev 237184)
@@ -109,7 +109,7 @@
     return historyItemWrappers;
 }
 
-void WKNotifyHistoryItemChanged(HistoryItem*)
+void WKNotifyHistoryItemChanged(HistoryItem&)
 {
 #if !PLATFORM(IOS)
     [[NSNotificationCenter defaultCenter]

Modified: trunk/Source/WebKitLegacy/mac/History/WebHistoryItemInternal.h (237183 => 237184)


--- trunk/Source/WebKitLegacy/mac/History/WebHistoryItemInternal.h	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKitLegacy/mac/History/WebHistoryItemInternal.h	2018-10-16 15:58:10 UTC (rev 237184)
@@ -33,13 +33,13 @@
 #import <wtf/text/WTFString.h>
 
 namespace WebCore {
-    class HistoryItem;
+class HistoryItem;
 }
 
 WebCore::HistoryItem* core(WebHistoryItem *item);
 WebHistoryItem *kit(WebCore::HistoryItem* item);
 
-extern void WKNotifyHistoryItemChanged(WebCore::HistoryItem*);
+extern void WKNotifyHistoryItemChanged(WebCore::HistoryItem&);
 
 @interface WebHistoryItem ()
 

Modified: trunk/Source/WebKitLegacy/win/BackForwardList.cpp (237183 => 237184)


--- trunk/Source/WebKitLegacy/win/BackForwardList.cpp	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKitLegacy/win/BackForwardList.cpp	2018-10-16 15:58:10 UTC (rev 237184)
@@ -99,14 +99,14 @@
     }
 }
 
-void BackForwardList::goToItem(HistoryItem* item)
+void BackForwardList::goToItem(HistoryItem& item)
 {
-    if (!m_entries.size() || !item)
+    if (!m_entries.size())
         return;
-        
+
     unsigned int index = 0;
     for (; index < m_entries.size(); ++index)
-        if (m_entries[index].ptr() == item)
+        if (m_entries[index].ptr() == &item)
             break;
     if (index < m_entries.size()) {
         m_current = index;

Modified: trunk/Source/WebKitLegacy/win/BackForwardList.h (237183 => 237184)


--- trunk/Source/WebKitLegacy/win/BackForwardList.h	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKitLegacy/win/BackForwardList.h	2018-10-16 15:58:10 UTC (rev 237184)
@@ -42,7 +42,7 @@
     void addItem(Ref<WebCore::HistoryItem>&&) override;
     void goBack();
     void goForward();
-    void goToItem(WebCore::HistoryItem*) override;
+    void goToItem(WebCore::HistoryItem&) override;
         
     WebCore::HistoryItem* backItem();
     WebCore::HistoryItem* currentItem();

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (237183 => 237184)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2018-10-16 15:58:10 UTC (rev 237184)
@@ -1,3 +1,16 @@
+2018-10-16  Alex Christensen  <[email protected]>
+
+        Replace HistoryItem* with HistoryItem& where possible
+        https://bugs.webkit.org/show_bug.cgi?id=190617
+
+        Reviewed by Chris Dumez.
+
+        * BackForwardList.cpp:
+        (BackForwardList::goToItem):
+        * BackForwardList.h:
+        * WebBackForwardList.cpp:
+        (WebBackForwardList::goToItem):
+
 2018-10-15  Alex Christensen  <[email protected]>
 
         Fix Windows build.

Modified: trunk/Source/WebKitLegacy/win/WebBackForwardList.cpp (237183 => 237184)


--- trunk/Source/WebKitLegacy/win/WebBackForwardList.cpp	2018-10-16 15:49:15 UTC (rev 237183)
+++ trunk/Source/WebKitLegacy/win/WebBackForwardList.cpp	2018-10-16 15:58:10 UTC (rev 237184)
@@ -145,7 +145,9 @@
     if (!item || FAILED(item->QueryInterface(&webHistoryItem)))
         return E_FAIL;
 
-    m_backForwardList->goToItem(webHistoryItem->historyItem());
+    if (auto item = webHistoryItem->historyItem())
+        m_backForwardList->goToItem(*item);
+
     return S_OK;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to