Title: [207300] trunk/Source
Revision
207300
Author
ander...@apple.com
Date
2016-10-13 12:15:23 -0700 (Thu, 13 Oct 2016)

Log Message

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.

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207299 => 207300)


--- trunk/Source/WebCore/ChangeLog	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebCore/ChangeLog	2016-10-13 19:15:23 UTC (rev 207300)
@@ -1,3 +1,23 @@
+2016-10-13  Anders Carlsson  <ander...@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  <grao...@apple.com>
 
         [Modern Media Controls] MediaControls base class

Modified: trunk/Source/WebCore/history/BackForwardList.cpp (207299 => 207300)


--- trunk/Source/WebCore/history/BackForwardList.cpp	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebCore/history/BackForwardList.cpp	2016-10-13 19:15:23 UTC (rev 207300)
@@ -136,7 +136,7 @@
     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::forwardListWithLimit(int limit, HistoryItemVector& list)
+void BackForwardList::forwardListWithLimit(int limit, Vector<Ref<HistoryItem>>& list)
 {
     ASSERT(limit > -1);
     list.clear();
@@ -220,7 +220,7 @@
     return m_entries[index + m_current].ptr();
 }
 
-HistoryItemVector& BackForwardList::entries()
+Vector<Ref<HistoryItem>>& BackForwardList::entries()
 {
     return m_entries;
 }

Modified: trunk/Source/WebCore/history/BackForwardList.h (207299 => 207300)


--- trunk/Source/WebCore/history/BackForwardList.h	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebCore/history/BackForwardList.h	2016-10-13 19:15:23 UTC (rev 207300)
@@ -36,7 +36,6 @@
 
 class Page;
 
-typedef Vector<Ref<HistoryItem>> HistoryItemVector;
 typedef HashSet<RefPtr<HistoryItem>> HistoryItemHashSet;
 
 class BackForwardList : public BackForwardClient {
@@ -56,8 +55,8 @@
     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 @@
     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 @@
     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;

Modified: trunk/Source/WebCore/history/HistoryItem.cpp (207299 => 207300)


--- trunk/Source/WebCore/history/HistoryItem.cpp	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebCore/history/HistoryItem.cpp	2016-10-13 19:15:23 UTC (rev 207300)
@@ -368,7 +368,7 @@
     return nullptr;
 }
 
-const HistoryItemVector& HistoryItem::children() const
+const Vector<Ref<HistoryItem>>& HistoryItem::children() const
 {
     return m_children;
 }

Modified: trunk/Source/WebCore/history/HistoryItem.h (207299 => 207300)


--- trunk/Source/WebCore/history/HistoryItem.h	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebCore/history/HistoryItem.h	2016-10-13 19:15:23 UTC (rev 207300)
@@ -56,8 +56,6 @@
 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 @@
     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 @@
 
     ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy { ShouldOpenExternalURLsPolicy::ShouldNotAllow };
     
-    HistoryItemVector m_children;
+    Vector<Ref<HistoryItem>> m_children;
     
     bool m_lastVisitWasFailure;
     bool m_isTargetItem;

Modified: trunk/Source/WebCore/loader/HistoryController.cpp (207299 => 207300)


--- trunk/Source/WebCore/loader/HistoryController.cpp	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebCore/loader/HistoryController.cpp	2016-10-13 19:15:23 UTC (rev 207300)
@@ -786,7 +786,7 @@
     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;
     

Modified: trunk/Source/WebKit/mac/ChangeLog (207299 => 207300)


--- trunk/Source/WebKit/mac/ChangeLog	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-10-13 19:15:23 UTC (rev 207300)
@@ -1,3 +1,21 @@
+2016-10-13  Anders Carlsson  <ander...@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  <cdu...@apple.com>
 
         [Web IDL] Drop support for legacy [ConstructorConditional=*]

Modified: trunk/Source/WebKit/mac/History/WebBackForwardList.mm (207299 => 207300)


--- trunk/Source/WebKit/mac/History/WebBackForwardList.mm	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebKit/mac/History/WebBackForwardList.mm	2016-10-13 19:15:23 UTC (rev 207300)
@@ -160,7 +160,7 @@
 {
     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 @@
     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 @@
 
 - (NSArray *)backListWithLimit:(int)limit
 {
-    HistoryItemVector list;
+    Vector<Ref<HistoryItem>> list;
     core(self)->backListWithLimit(limit, list);
     NSArray *result = vectorToNSArray(list);
     
@@ -271,7 +271,7 @@
 
 - (NSArray *)forwardListWithLimit:(int)limit
 {
-    HistoryItemVector list;
+    Vector<Ref<HistoryItem>> list;
     core(self)->forwardListWithLimit(limit, list);
     NSArray *result = vectorToNSArray(list);
     
@@ -305,7 +305,7 @@
     [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) {

Modified: trunk/Source/WebKit/mac/History/WebHistoryItem.mm (207299 => 207300)


--- trunk/Source/WebKit/mac/History/WebHistoryItem.mm	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebKit/mac/History/WebHistoryItem.mm	2016-10-13 19:15:23 UTC (rev 207300)
@@ -235,7 +235,7 @@
     }
     
     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 @@
 #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 @@
 
 - (NSArray *)children
 {
-    const HistoryItemVector& children = core(_private)->children();
+    const auto& children = core(_private)->children();
     if (!children.size())
         return nil;
 

Modified: trunk/Source/WebKit/win/ChangeLog (207299 => 207300)


--- trunk/Source/WebKit/win/ChangeLog	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebKit/win/ChangeLog	2016-10-13 19:15:23 UTC (rev 207300)
@@ -1,3 +1,18 @@
+2016-10-13  Anders Carlsson  <ander...@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  <bfulg...@apple.com>
 
         [Win] Unreviewed build fix after r207218.

Modified: trunk/Source/WebKit/win/WebBackForwardList.cpp (207299 => 207300)


--- trunk/Source/WebKit/win/WebBackForwardList.cpp	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebKit/win/WebBackForwardList.cpp	2016-10-13 19:15:23 UTC (rev 207300)
@@ -194,7 +194,7 @@
 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::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());

Modified: trunk/Source/WebKit/win/WebHistoryItem.cpp (207299 => 207300)


--- trunk/Source/WebKit/win/WebHistoryItem.cpp	2016-10-13 19:02:29 UTC (rev 207299)
+++ trunk/Source/WebKit/win/WebHistoryItem.cpp	2016-10-13 19:15:23 UTC (rev 207300)
@@ -289,7 +289,7 @@
     *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();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to