Changeset 237184 in webkit
- Timestamp:
- Oct 16, 2018, 8:58:10 AM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r237182 r237184 1 2018-10-16 Alex Christensen <achristensen@webkit.org> 2 3 Replace HistoryItem* with HistoryItem& where possible 4 https://bugs.webkit.org/show_bug.cgi?id=190617 5 6 Reviewed by Chris Dumez. 7 8 * history/BackForwardClient.h: 9 * history/BackForwardController.cpp: 10 (WebCore::BackForwardController::setCurrentItem): 11 * history/BackForwardController.h: 12 * history/HistoryItem.cpp: 13 (WebCore::defaultNotifyHistoryItemChanged): 14 (WebCore::HistoryItem::setAlternateTitle): 15 (WebCore::HistoryItem::setURLString): 16 (WebCore::HistoryItem::setOriginalURLString): 17 (WebCore::HistoryItem::setReferrer): 18 (WebCore::HistoryItem::setTitle): 19 (WebCore::HistoryItem::setTarget): 20 (WebCore::HistoryItem::setShouldRestoreScrollPosition): 21 (WebCore::HistoryItem::setStateObject): 22 (WebCore::HistoryItem::notifyChanged): 23 * history/HistoryItem.h: 24 * loader/EmptyClients.cpp: 25 * loader/FrameLoader.cpp: 26 (WebCore::FrameLoader::checkLoadCompleteForThisFrame): 27 (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): 28 (WebCore::FrameLoader::loadSameDocumentItem): 29 * loader/HistoryController.cpp: 30 (WebCore::HistoryController::goToItem): 31 (WebCore::HistoryController::updateForCommit): 32 (WebCore::HistoryController::recursiveUpdateForCommit): 33 (WebCore::HistoryController::recursiveUpdateForSameDocumentNavigation): 34 (WebCore::HistoryController::setCurrentItem): 35 (WebCore::HistoryController::createItem): 36 (WebCore::HistoryController::itemsAreClones const): 37 (WebCore::HistoryController::currentFramesMatchItem const): 38 * loader/HistoryController.h: 39 1 40 2018-10-16 Alex Christensen <achristensen@webkit.org> 2 41 -
trunk/Source/WebCore/history/BackForwardClient.h
r237157 r237184 43 43 virtual void addItem(Ref<HistoryItem>&&) = 0; 44 44 45 virtual void goToItem(HistoryItem *) = 0;45 virtual void goToItem(HistoryItem&) = 0; 46 46 47 47 virtual HistoryItem* itemAtIndex(int) = 0; -
trunk/Source/WebCore/history/BackForwardController.cpp
r232730 r237184 99 99 } 100 100 101 void BackForwardController::setCurrentItem(HistoryItem *item)101 void BackForwardController::setCurrentItem(HistoryItem& item) 102 102 { 103 103 m_client->goToItem(item); -
trunk/Source/WebCore/history/BackForwardController.h
r237157 r237184 52 52 53 53 void addItem(Ref<HistoryItem>&&); 54 void setCurrentItem(HistoryItem *);54 void setCurrentItem(HistoryItem&); 55 55 56 56 int count() const; -
trunk/Source/WebCore/history/HistoryItem.cpp
r236762 r237184 50 50 } 51 51 52 static void defaultNotifyHistoryItemChanged(HistoryItem *)53 { 54 } 55 56 WEBCORE_EXPORT void (*notifyHistoryItemChanged)(HistoryItem*) = defaultNotifyHistoryItemChanged;52 static void defaultNotifyHistoryItemChanged(HistoryItem&) 53 { 54 } 55 56 void (*notifyHistoryItemChanged)(HistoryItem&) = defaultNotifyHistoryItemChanged; 57 57 58 58 HistoryItem::HistoryItem() … … 196 196 { 197 197 m_displayTitle = alternateTitle; 198 notify HistoryItemChanged(this);198 notifyChanged(); 199 199 } 200 200 … … 202 202 { 203 203 m_urlString = urlString; 204 notify HistoryItemChanged(this);204 notifyChanged(); 205 205 } 206 206 … … 215 215 { 216 216 m_originalURLString = urlString; 217 notify HistoryItemChanged(this);217 notifyChanged(); 218 218 } 219 219 … … 221 221 { 222 222 m_referrer = referrer; 223 notify HistoryItemChanged(this);223 notifyChanged(); 224 224 } 225 225 … … 227 227 { 228 228 m_title = title; 229 notify HistoryItemChanged(this);229 notifyChanged(); 230 230 } 231 231 … … 233 233 { 234 234 m_target = target; 235 notify HistoryItemChanged(this);235 notifyChanged(); 236 236 } 237 237 … … 259 259 { 260 260 m_shouldRestoreScrollPosition = shouldRestore; 261 notify HistoryItemChanged(this);261 notifyChanged(); 262 262 } 263 263 … … 310 310 { 311 311 m_stateObject = WTFMove(object); 312 notify HistoryItemChanged(this);312 notifyChanged(); 313 313 } 314 314 … … 466 466 void HistoryItem::notifyChanged() 467 467 { 468 notifyHistoryItemChanged( this);468 notifyHistoryItemChanged(*this); 469 469 } 470 470 -
trunk/Source/WebCore/history/HistoryItem.h
r237182 r237184 58 58 enum class PruningReason; 59 59 60 WEBCORE_EXPORT extern void (*notifyHistoryItemChanged)(HistoryItem *);60 WEBCORE_EXPORT extern void (*notifyHistoryItemChanged)(HistoryItem&); 61 61 62 62 class HistoryItem : public RefCounted<HistoryItem> { -
trunk/Source/WebCore/loader/EmptyClients.cpp
r237157 r237184 84 84 class EmptyBackForwardClient final : public BackForwardClient { 85 85 void addItem(Ref<HistoryItem>&&) final { } 86 void goToItem(HistoryItem *) final { }86 void goToItem(HistoryItem&) final { } 87 87 HistoryItem* itemAtIndex(int) final { return nullptr; } 88 88 int backListCount() const final { return 0; } -
trunk/Source/WebCore/loader/FrameLoader.cpp
r237148 r237184 2437 2437 if (shouldReset && item) 2438 2438 if (Page* page = m_frame.page()) { 2439 page->backForward().setCurrentItem( item.get());2439 page->backForward().setCurrentItem(*item); 2440 2440 } 2441 2441 return; … … 3302 3302 if (Page* page = m_frame.page()) { 3303 3303 if (HistoryItem* resetItem = m_frame.mainFrame().loader().history().currentItem()) 3304 page->backForward().setCurrentItem( resetItem);3304 page->backForward().setCurrentItem(*resetItem); 3305 3305 } 3306 3306 } … … 3562 3562 view->setWasScrolledByUser(false); 3563 3563 3564 history().setCurrentItem( &item);3564 history().setCurrentItem(item); 3565 3565 3566 3566 // loadInSameDocument() actually changes the URL and notifies load delegates of a "fake" load -
trunk/Source/WebCore/loader/HistoryController.cpp
r237148 r237184 317 317 // as opposed to happening for some/one of the page commits that might happen soon 318 318 RefPtr<HistoryItem> currentItem = page->backForward().currentItem(); 319 page->backForward().setCurrentItem( &targetItem);319 page->backForward().setCurrentItem(targetItem); 320 320 321 321 // First set the provisional item of any frames that are not actually navigating. … … 485 485 // We should get to the bottom of this. 486 486 ASSERT(m_provisionalItem); 487 setCurrentItem(m_provisionalItem.get()); 487 if (m_provisionalItem) 488 setCurrentItem(*m_provisionalItem.get()); 488 489 m_provisionalItem = nullptr; 489 490 … … 526 527 527 528 // Now commit the provisional item 528 setCurrentItem(m_provisionalItem.get()); 529 if (m_provisionalItem) 530 setCurrentItem(*m_provisionalItem.get()); 529 531 m_provisionalItem = nullptr; 530 532 … … 575 577 576 578 // Commit the provisional item. 577 setCurrentItem(m_provisionalItem.get()); 579 if (m_provisionalItem) 580 setCurrentItem(*m_provisionalItem.get()); 578 581 m_provisionalItem = nullptr; 579 582 … … 591 594 } 592 595 593 void HistoryController::setCurrentItem(HistoryItem *item)596 void HistoryController::setCurrentItem(HistoryItem& item) 594 597 { 595 598 m_frameLoadComplete = false; 596 599 m_previousItem = m_currentItem; 597 m_currentItem = item;600 m_currentItem = &item; 598 601 } 599 602 … … 677 680 678 681 // Set the item for which we will save document state 679 setCurrentItem(item .ptr());682 setCurrentItem(item); 680 683 681 684 return item; … … 776 779 && &item1 != item2 777 780 && item1.itemSequenceNumber() == item2->itemSequenceNumber() 778 && currentFramesMatchItem( &item1)781 && currentFramesMatchItem(item1) 779 782 && item2->hasSameFrames(item1); 780 783 } 781 784 782 785 // Helper method that determines whether the current frame tree matches given history item's. 783 bool HistoryController::currentFramesMatchItem(HistoryItem *item) const784 { 785 if ((!m_frame.tree().uniqueName().isEmpty() || !item ->target().isEmpty()) && m_frame.tree().uniqueName() != item->target())786 bool HistoryController::currentFramesMatchItem(HistoryItem& item) const 787 { 788 if ((!m_frame.tree().uniqueName().isEmpty() || !item.target().isEmpty()) && m_frame.tree().uniqueName() != item.target()) 786 789 return false; 787 788 const auto& childItems = item ->children();790 791 const auto& childItems = item.children(); 789 792 if (childItems.size() != m_frame.tree().childCount()) 790 793 return false; -
trunk/Source/WebCore/loader/HistoryController.h
r237110 r237184 76 76 77 77 HistoryItem* currentItem() const { return m_currentItem.get(); } 78 void setCurrentItem(HistoryItem *);78 void setCurrentItem(HistoryItem&); 79 79 void setCurrentItemTitle(const StringWithDirection&); 80 80 bool currentItemShouldBeReplaced() const; … … 108 108 void recursiveUpdateForSameDocumentNavigation(); 109 109 bool itemsAreClones(HistoryItem&, HistoryItem*) const; 110 bool currentFramesMatchItem(HistoryItem *) const;110 bool currentFramesMatchItem(HistoryItem&) const; 111 111 void updateBackForwardListClippedAtTarget(bool doClip); 112 112 void updateCurrentItem(); -
trunk/Source/WebKit/ChangeLog
r237177 r237184 1 2018-10-16 Alex Christensen <achristensen@webkit.org> 2 3 Replace HistoryItem* with HistoryItem& where possible 4 https://bugs.webkit.org/show_bug.cgi?id=190617 5 6 Reviewed by Chris Dumez. 7 8 * WebProcess/WebCoreSupport/SessionStateConversion.h: 9 * WebProcess/WebPage/WebBackForwardListProxy.cpp: 10 (WebKit::WK2NotifyHistoryItemChanged): 11 (WebKit::WebBackForwardListProxy::goToItem): 12 * WebProcess/WebPage/WebBackForwardListProxy.h: 13 1 14 2018-10-16 Philippe Normand <pnormand@igalia.com> 2 15 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.h
r230812 r237184 24 24 */ 25 25 26 #ifndef SessionStateConversion_h 27 #define SessionStateConversion_h 26 #pragma once 28 27 29 28 #include <wtf/Forward.h> … … 36 35 37 36 struct BackForwardListItemState; 38 struct PageState;39 37 40 38 BackForwardListItemState toBackForwardListItemState(const WebCore::HistoryItem&); … … 42 40 43 41 } // namespace WebKit 44 45 #endif // SessionStateConversion_h -
trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp
r237157 r237184 63 63 } 64 64 65 static void WK2NotifyHistoryItemChanged(HistoryItem *item)65 static void WK2NotifyHistoryItemChanged(HistoryItem& item) 66 66 { 67 WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::UpdateBackForwardItem(toBackForwardListItemState( *item)), 0);67 WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::UpdateBackForwardItem(toBackForwardListItemState(item)), 0); 68 68 } 69 69 … … 101 101 } 102 102 103 void WebBackForwardListProxy::goToItem(HistoryItem *item)103 void WebBackForwardListProxy::goToItem(HistoryItem& item) 104 104 { 105 105 if (!m_page) … … 107 107 108 108 SandboxExtension::Handle sandboxExtensionHandle; 109 m_page->sendSync(Messages::WebPageProxy::BackForwardGoToItem(item ->identifier()), Messages::WebPageProxy::BackForwardGoToItem::Reply(sandboxExtensionHandle));109 m_page->sendSync(Messages::WebPageProxy::BackForwardGoToItem(item.identifier()), Messages::WebPageProxy::BackForwardGoToItem::Reply(sandboxExtensionHandle)); 110 110 m_page->sandboxExtensionTracker().beginLoad(m_page->mainWebFrame(), WTFMove(sandboxExtensionHandle)); 111 111 } -
trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h
r237157 r237184 57 57 void addItem(Ref<WebCore::HistoryItem>&&) override; 58 58 59 void goToItem(WebCore::HistoryItem *) override;59 void goToItem(WebCore::HistoryItem&) override; 60 60 61 61 WebCore::HistoryItem* itemAtIndex(int) override; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r237182 r237184 1 2018-10-16 Alex Christensen <achristensen@webkit.org> 2 3 Replace HistoryItem* with HistoryItem& where possible 4 https://bugs.webkit.org/show_bug.cgi?id=190617 5 6 Reviewed by Chris Dumez. 7 8 * History/BackForwardList.h: 9 * History/BackForwardList.mm: 10 (BackForwardList::goToItem): 11 * History/WebBackForwardList.mm: 12 (-[WebBackForwardList goToItem:]): 13 * History/WebHistoryItem.mm: 14 (WKNotifyHistoryItemChanged): 15 * History/WebHistoryItemInternal.h: 16 1 17 2018-10-16 Alex Christensen <achristensen@webkit.org> 2 18 -
trunk/Source/WebKitLegacy/mac/History/BackForwardList.h
r237157 r237184 46 46 void goBack(); 47 47 void goForward(); 48 void goToItem(WebCore::HistoryItem *) override;48 void goToItem(WebCore::HistoryItem&) override; 49 49 50 50 WebCore::HistoryItem* backItem(); -
trunk/Source/WebKitLegacy/mac/History/BackForwardList.mm
r237157 r237184 92 92 } 93 93 94 void BackForwardList::goToItem(HistoryItem *item)95 { 96 if (!m_entries.size() || !item)94 void BackForwardList::goToItem(HistoryItem& item) 95 { 96 if (!m_entries.size()) 97 97 return; 98 98 99 99 unsigned index = 0; 100 100 for (; index < m_entries.size(); ++index) { 101 if (m_entries[index].ptr() == item)101 if (m_entries[index].ptr() == &item) 102 102 break; 103 103 } -
trunk/Source/WebKitLegacy/mac/History/WebBackForwardList.mm
r237157 r237184 220 220 - (void)goToItem:(WebHistoryItem *)item 221 221 { 222 core(self)->goToItem(core(item)); 222 if (item) 223 core(self)->goToItem(*core(item)); 223 224 } 224 225 -
trunk/Source/WebKitLegacy/mac/History/WebHistoryItem.mm
r237182 r237184 110 110 } 111 111 112 void WKNotifyHistoryItemChanged(HistoryItem *)112 void WKNotifyHistoryItemChanged(HistoryItem&) 113 113 { 114 114 #if !PLATFORM(IOS) -
trunk/Source/WebKitLegacy/mac/History/WebHistoryItemInternal.h
r216816 r237184 34 34 35 35 namespace WebCore { 36 36 class HistoryItem; 37 37 } 38 38 … … 40 40 WebHistoryItem *kit(WebCore::HistoryItem* item); 41 41 42 extern void WKNotifyHistoryItemChanged(WebCore::HistoryItem *);42 extern void WKNotifyHistoryItemChanged(WebCore::HistoryItem&); 43 43 44 44 @interface WebHistoryItem () -
trunk/Source/WebKitLegacy/win/BackForwardList.cpp
r237157 r237184 100 100 } 101 101 102 void BackForwardList::goToItem(HistoryItem *item)103 { 104 if (!m_entries.size() || !item)105 return; 106 102 void BackForwardList::goToItem(HistoryItem& item) 103 { 104 if (!m_entries.size()) 105 return; 106 107 107 unsigned int index = 0; 108 108 for (; index < m_entries.size(); ++index) 109 if (m_entries[index].ptr() == item)109 if (m_entries[index].ptr() == &item) 110 110 break; 111 111 if (index < m_entries.size()) { -
trunk/Source/WebKitLegacy/win/BackForwardList.h
r237157 r237184 43 43 void goBack(); 44 44 void goForward(); 45 void goToItem(WebCore::HistoryItem *) override;45 void goToItem(WebCore::HistoryItem&) override; 46 46 47 47 WebCore::HistoryItem* backItem(); -
trunk/Source/WebKitLegacy/win/ChangeLog
r237165 r237184 1 2018-10-16 Alex Christensen <achristensen@webkit.org> 2 3 Replace HistoryItem* with HistoryItem& where possible 4 https://bugs.webkit.org/show_bug.cgi?id=190617 5 6 Reviewed by Chris Dumez. 7 8 * BackForwardList.cpp: 9 (BackForwardList::goToItem): 10 * BackForwardList.h: 11 * WebBackForwardList.cpp: 12 (WebBackForwardList::goToItem): 13 1 14 2018-10-15 Alex Christensen <achristensen@webkit.org> 2 15 -
trunk/Source/WebKitLegacy/win/WebBackForwardList.cpp
r216823 r237184 146 146 return E_FAIL; 147 147 148 m_backForwardList->goToItem(webHistoryItem->historyItem()); 148 if (auto item = webHistoryItem->historyItem()) 149 m_backForwardList->goToItem(*item); 150 149 151 return S_OK; 150 152 }
Note:
See TracChangeset
for help on using the changeset viewer.