Get rid of the HistoryItemVector typedef
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Oct 2016 19:15:23 +0000 (19:15 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Oct 2016 19:15:23 +0000 (19:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163398

Reviewed by Beth Dakin.

Expand the HistoryitemVector typedef instead to make it more clear what types we are dealing with.

Source/WebCore:

* history/BackForwardList.cpp:
(WebCore::BackForwardList::backListWithLimit):
(WebCore::BackForwardList::forwardListWithLimit):
(WebCore::BackForwardList::entries):
* history/BackForwardList.h:
* history/HistoryItem.cpp:
(WebCore::HistoryItem::children):
* history/HistoryItem.h:
* loader/HistoryController.cpp:
(WebCore::HistoryController::currentFramesMatchItem):

Source/WebKit/mac:

* History/WebBackForwardList.mm:
(-[WebBackForwardList dictionaryRepresentation]):
(vectorToNSArray):
(-[WebBackForwardList backListWithLimit:]):
(-[WebBackForwardList forwardListWithLimit:]):
(-[WebBackForwardList description]):
* History/WebHistoryItem.mm:
(-[WebHistoryItem description]):

Source/WebKit/win:

* WebBackForwardList.cpp:
(WebBackForwardList::backListWithLimit):
(WebBackForwardList::forwardListWithLimit):
* WebHistoryItem.cpp:
(WebHistoryItem::children):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207300 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/history/BackForwardList.cpp
Source/WebCore/history/BackForwardList.h
Source/WebCore/history/HistoryItem.cpp
Source/WebCore/history/HistoryItem.h
Source/WebCore/loader/HistoryController.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/History/WebBackForwardList.mm
Source/WebKit/mac/History/WebHistoryItem.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebBackForwardList.cpp
Source/WebKit/win/WebHistoryItem.cpp

index 0ce12de..46501c6 100644 (file)
@@ -1,3 +1,23 @@
+2016-10-13  Anders Carlsson  <andersca@apple.com>
+
+        Get rid of the HistoryItemVector typedef
+        https://bugs.webkit.org/show_bug.cgi?id=163398
+
+        Reviewed by Beth Dakin.
+
+        Expand the HistoryitemVector typedef instead to make it more clear what types we are dealing with.
+
+        * history/BackForwardList.cpp:
+        (WebCore::BackForwardList::backListWithLimit):
+        (WebCore::BackForwardList::forwardListWithLimit):
+        (WebCore::BackForwardList::entries):
+        * history/BackForwardList.h:
+        * history/HistoryItem.cpp:
+        (WebCore::HistoryItem::children):
+        * history/HistoryItem.h:
+        * loader/HistoryController.cpp:
+        (WebCore::HistoryController::currentFramesMatchItem):
+
 2016-10-13  Antoine Quint  <graouts@apple.com>
 
         [Modern Media Controls] MediaControls base class
index 5a378d7..bc3b270 100644 (file)
@@ -136,7 +136,7 @@ HistoryItem* BackForwardList::forwardItem()
     return nullptr;
 }
 
-void BackForwardList::backListWithLimit(int limit, HistoryItemVector& list)
+void BackForwardList::backListWithLimit(int limit, Vector<Ref<HistoryItem>>& list)
 {
     list.clear();
     if (m_current != NoCurrentItemIndex) {
@@ -146,7 +146,7 @@ void BackForwardList::backListWithLimit(int limit, HistoryItemVector& list)
     }
 }
 
-void BackForwardList::forwardListWithLimit(int limit, HistoryItemVector& list)
+void BackForwardList::forwardListWithLimit(int limit, Vector<Ref<HistoryItem>>& list)
 {
     ASSERT(limit > -1);
     list.clear();
@@ -220,7 +220,7 @@ HistoryItem* BackForwardList::itemAtIndex(int index)
     return m_entries[index + m_current].ptr();
 }
 
-HistoryItemVector& BackForwardList::entries()
+Vector<Ref<HistoryItem>>& BackForwardList::entries()
 {
     return m_entries;
 }
index 3eca208..57c44ab 100644 (file)
@@ -36,7 +36,6 @@ namespace WebCore {
 
 class Page;
 
-typedef Vector<Ref<HistoryItem>> HistoryItemVector;
 typedef HashSet<RefPtr<HistoryItem>> HistoryItemHashSet;
 
 class BackForwardList : public BackForwardClient {
@@ -56,8 +55,8 @@ public:
     WEBCORE_EXPORT HistoryItem* forwardItem();
     HistoryItem* itemAtIndex(int) override;
 
-    WEBCORE_EXPORT void backListWithLimit(int, HistoryItemVector&);
-    WEBCORE_EXPORT void forwardListWithLimit(int, HistoryItemVector&);
+    WEBCORE_EXPORT void backListWithLimit(int, Vector<Ref<HistoryItem>>&);
+    WEBCORE_EXPORT void forwardListWithLimit(int, Vector<Ref<HistoryItem>>&);
 
     WEBCORE_EXPORT int capacity();
     WEBCORE_EXPORT void setCapacity(int);
@@ -71,7 +70,7 @@ public:
     WEBCORE_EXPORT bool closed();
 
     WEBCORE_EXPORT void removeItem(HistoryItem*);
-    WEBCORE_EXPORT HistoryItemVector& entries();
+    WEBCORE_EXPORT Vector<Ref<HistoryItem>>& entries();
 
 #if PLATFORM(IOS)
     unsigned current() override;
@@ -84,7 +83,7 @@ private:
     WEBCORE_EXPORT explicit BackForwardList(Page*);
 
     Page* m_page;
-    HistoryItemVector m_entries;
+    Vector<Ref<HistoryItem>> m_entries;
     HistoryItemHashSet m_entryHash;
     unsigned m_current;
     unsigned m_capacity;
index c82f159..fbeaa96 100644 (file)
@@ -368,7 +368,7 @@ HistoryItem* HistoryItem::childItemWithDocumentSequenceNumber(long long number)
     return nullptr;
 }
 
-const HistoryItemVector& HistoryItem::children() const
+const Vector<Ref<HistoryItem>>& HistoryItem::children() const
 {
     return m_children;
 }
index 8bfb4fc..39f5114 100644 (file)
@@ -56,8 +56,6 @@ class ResourceRequest;
 class URL;
 enum class PruningReason;
 
-typedef Vector<Ref<HistoryItem>> HistoryItemVector;
-
 WEBCORE_EXPORT extern void (*notifyHistoryItemChanged)(HistoryItem*);
 
 class HistoryItem : public RefCounted<HistoryItem> {
@@ -143,7 +141,7 @@ public:
     void setChildItem(Ref<HistoryItem>&&);
     WEBCORE_EXPORT HistoryItem* childItemWithTarget(const String&);
     HistoryItem* childItemWithDocumentSequenceNumber(long long number);
-    WEBCORE_EXPORT const HistoryItemVector& children() const;
+    WEBCORE_EXPORT const Vector<Ref<HistoryItem>>& children() const;
     WEBCORE_EXPORT bool hasChildren() const;
     void clearChildren();
     bool isAncestorOf(const HistoryItem&) const;
@@ -233,7 +231,7 @@ private:
 
     ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy { ShouldOpenExternalURLsPolicy::ShouldNotAllow };
     
-    HistoryItemVector m_children;
+    Vector<Ref<HistoryItem>> m_children;
     
     bool m_lastVisitWasFailure;
     bool m_isTargetItem;
index cf6e19c..3ef58ff 100644 (file)
@@ -786,7 +786,7 @@ bool HistoryController::currentFramesMatchItem(HistoryItem* item) const
     if ((!m_frame.tree().uniqueName().isEmpty() || !item->target().isEmpty()) && m_frame.tree().uniqueName() != item->target())
         return false;
         
-    const HistoryItemVector& childItems = item->children();
+    const auto& childItems = item->children();
     if (childItems.size() != m_frame.tree().childCount())
         return false;
     
index 46b3163..92e3b6f 100644 (file)
@@ -1,3 +1,21 @@
+2016-10-13  Anders Carlsson  <andersca@apple.com>
+
+        Get rid of the HistoryItemVector typedef
+        https://bugs.webkit.org/show_bug.cgi?id=163398
+
+        Reviewed by Beth Dakin.
+
+        Expand the HistoryitemVector typedef instead to make it more clear what types we are dealing with.
+
+        * History/WebBackForwardList.mm:
+        (-[WebBackForwardList dictionaryRepresentation]):
+        (vectorToNSArray):
+        (-[WebBackForwardList backListWithLimit:]):
+        (-[WebBackForwardList forwardListWithLimit:]):
+        (-[WebBackForwardList description]):
+        * History/WebHistoryItem.mm:
+        (-[WebHistoryItem description]):
+
 2016-10-12  Chris Dumez  <cdumez@apple.com>
 
         [Web IDL] Drop support for legacy [ConstructorConditional=*]
index 4f76db7..126c7d9 100644 (file)
@@ -160,7 +160,7 @@ WebBackForwardList *kit(BackForwardList* backForwardList)
 {
     BackForwardList *coreBFList = core(self);
     
-    HistoryItemVector& historyItems = coreBFList->entries();
+    auto& historyItems = coreBFList->entries();
     unsigned size = historyItems.size();
     NSMutableArray *entriesArray = [[NSMutableArray alloc] initWithCapacity:size];
     for (unsigned i = 0; i < size; ++i)
@@ -232,7 +232,7 @@ WebBackForwardList *kit(BackForwardList* backForwardList)
     return [[kit(core(self)->forwardItem()) retain] autorelease];
 }
 
-static NSArray* vectorToNSArray(HistoryItemVector& list)
+static NSArray* vectorToNSArray(Vector<Ref<HistoryItem>>& list)
 {
     unsigned size = list.size();
     NSMutableArray *result = [[[NSMutableArray alloc] initWithCapacity:size] autorelease];
@@ -256,7 +256,7 @@ static bool bumperCarBackForwardHackNeeded()
 
 - (NSArray *)backListWithLimit:(int)limit
 {
-    HistoryItemVector list;
+    Vector<Ref<HistoryItem>> list;
     core(self)->backListWithLimit(limit, list);
     NSArray *result = vectorToNSArray(list);
     
@@ -271,7 +271,7 @@ static bool bumperCarBackForwardHackNeeded()
 
 - (NSArray *)forwardListWithLimit:(int)limit
 {
-    HistoryItemVector list;
+    Vector<Ref<HistoryItem>> list;
     core(self)->forwardListWithLimit(limit, list);
     NSArray *result = vectorToNSArray(list);
     
@@ -305,7 +305,7 @@ static bool bumperCarBackForwardHackNeeded()
     [result appendString:@"WebBackForwardList:\n"];
     
     BackForwardList* backForwardList = core(self);
-    HistoryItemVector& entries = backForwardList->entries();
+    auto& entries = backForwardList->entries();
     
     unsigned size = entries.size();
     for (unsigned i = 0; i < size; ++i) {
index 2dbcc16..8aa8fb3 100644 (file)
@@ -235,7 +235,7 @@ void WKNotifyHistoryItemChanged(HistoryItem*)
     }
     
     if (coreItem->children().size()) {
-        const HistoryItemVector& children = coreItem->children();
+        const auto& children = coreItem->children();
         int currPos = [result length];
         unsigned size = children.size();        
         for (unsigned i = 0; i < size; ++i) {
@@ -456,7 +456,7 @@ WebHistoryItem *kit(HistoryItem* item)
 #else
     if (coreItem->children().size()) {
 #endif
-        const HistoryItemVector& children = coreItem->children();
+        const auto& children = coreItem->children();
         NSMutableArray *childDicts = [NSMutableArray arrayWithCapacity:children.size()];
         
         for (int i = children.size() - 1; i >= 0; i--)
@@ -510,7 +510,7 @@ WebHistoryItem *kit(HistoryItem* item)
 
 - (NSArray *)children
 {
-    const HistoryItemVector& children = core(_private)->children();
+    const auto& children = core(_private)->children();
     if (!children.size())
         return nil;
 
index 143e905..b939b72 100644 (file)
@@ -1,3 +1,18 @@
+2016-10-13  Anders Carlsson  <andersca@apple.com>
+
+        Get rid of the HistoryItemVector typedef
+        https://bugs.webkit.org/show_bug.cgi?id=163398
+
+        Reviewed by Beth Dakin.
+
+        Expand the HistoryitemVector typedef instead to make it more clear what types we are dealing with.
+
+        * WebBackForwardList.cpp:
+        (WebBackForwardList::backListWithLimit):
+        (WebBackForwardList::forwardListWithLimit):
+        * WebHistoryItem.cpp:
+        (WebHistoryItem::children):
+
 2016-10-12  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Unreviewed build fix after r207218.
index dddb44c..d08017a 100644 (file)
@@ -194,7 +194,7 @@ HRESULT WebBackForwardList::forwardItem(_COM_Outptr_opt_ IWebHistoryItem** item)
 HRESULT WebBackForwardList::backListWithLimit(int limit, _Out_ int* listCount,
     __deref_inout_opt IWebHistoryItem** list)
 {
-    HistoryItemVector historyItemVector;
+    Vector<Ref<HistoryItem>> historyItemVector;
     m_backForwardList->backListWithLimit(limit, historyItemVector);
 
     *listCount = static_cast<int>(historyItemVector.size());
@@ -211,7 +211,7 @@ HRESULT WebBackForwardList::backListWithLimit(int limit, _Out_ int* listCount,
 HRESULT WebBackForwardList::forwardListWithLimit(int limit, _Out_ int* listCount,
     __deref_inout_opt IWebHistoryItem** list)
 {
-    HistoryItemVector historyItemVector;
+    Vector<Ref<HistoryItem>> historyItemVector;
     m_backForwardList->forwardListWithLimit(limit, historyItemVector);
 
     *listCount = static_cast<int>(historyItemVector.size());
index d48dc25..5fcd866 100644 (file)
@@ -289,7 +289,7 @@ HRESULT WebHistoryItem::children(unsigned* outChildCount, SAFEARRAY** outChildre
     *outChildCount = 0;
     *outChildren = 0;
 
-    const HistoryItemVector& coreChildren = m_historyItem->children();
+    const auto& coreChildren = m_historyItem->children();
     if (coreChildren.isEmpty())
         return S_OK;
     size_t childCount = coreChildren.size();