Title: [207482] trunk/Source
Revision
207482
Author
ander...@apple.com
Date
2016-10-18 13:22:58 -0700 (Tue, 18 Oct 2016)

Log Message

Move some history specific HistoryItem code to WebHistoryItem
https://bugs.webkit.org/show_bug.cgi?id=163567

Reviewed by Tim Horton.

Source/WebCore:

* history/HistoryItem.cpp:
(WebCore::HistoryItem::addRedirectURL): Deleted.
(WebCore::HistoryItem::redirectURLs): Deleted.
(WebCore::HistoryItem::setRedirectURLs): Deleted.
* history/HistoryItem.h:

Source/WebKit/mac:

* History/HistoryPropertyList.mm:
(HistoryPropertyListWriter::writeHistoryItem):
* History/WebHistory.mm:
(-[WebHistory _visitedURL:withTitle:method:wasFailure:]):
* History/WebHistoryItem.mm:
(-[WebHistoryItem initFromDictionaryRepresentation:]):
* History/WebHistoryItemInternal.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(addRedirectURL):
(WebFrameLoaderClient::updateGlobalHistoryRedirectLinks):

Source/WebKit/win:

Remove these, they aren't used.

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::updateGlobalHistoryRedirectLinks):
* WebHistory.cpp:
(WebHistory::visitedURL):
* WebHistoryItem.cpp:
(WebHistoryItem::initFromDictionaryRepresentation):
(WebHistoryItem::dictionaryRepresentation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207481 => 207482)


--- trunk/Source/WebCore/ChangeLog	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebCore/ChangeLog	2016-10-18 20:22:58 UTC (rev 207482)
@@ -1,3 +1,16 @@
+2016-10-17  Anders Carlsson  <ander...@apple.com>
+
+        Move some history specific HistoryItem code to WebHistoryItem
+        https://bugs.webkit.org/show_bug.cgi?id=163567
+
+        Reviewed by Tim Horton.
+
+        * history/HistoryItem.cpp:
+        (WebCore::HistoryItem::addRedirectURL): Deleted.
+        (WebCore::HistoryItem::redirectURLs): Deleted.
+        (WebCore::HistoryItem::setRedirectURLs): Deleted.
+        * history/HistoryItem.h:
+
 2016-10-18  Dave Hyatt  <hy...@apple.com>
 
         [CSS Parser] Get all the properties turned on

Modified: trunk/Source/WebCore/history/HistoryItem.cpp (207481 => 207482)


--- trunk/Source/WebCore/history/HistoryItem.cpp	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebCore/history/HistoryItem.cpp	2016-10-18 20:22:58 UTC (rev 207482)
@@ -479,27 +479,6 @@
     return equalIgnoringFragmentIdentifier(url(), document.url());
 }
 
-void HistoryItem::addRedirectURL(const String& url)
-{
-    if (!m_redirectURLs)
-        m_redirectURLs = std::make_unique<Vector<String>>();
-
-    // Our API allows us to store all the URLs in the redirect chain, but for
-    // now we only have a use for the final URL.
-    (*m_redirectURLs).resize(1);
-    (*m_redirectURLs)[0] = url;
-}
-
-Vector<String>* HistoryItem::redirectURLs() const
-{
-    return m_redirectURLs.get();
-}
-
-void HistoryItem::setRedirectURLs(std::unique_ptr<Vector<String>> redirectURLs)
-{
-    m_redirectURLs = WTFMove(redirectURLs);
-}
-
 void HistoryItem::notifyChanged()
 {
     notifyHistoryItemChanged(this);

Modified: trunk/Source/WebCore/history/HistoryItem.h (207481 => 207482)


--- trunk/Source/WebCore/history/HistoryItem.h	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebCore/history/HistoryItem.h	2016-10-18 20:22:58 UTC (rev 207482)
@@ -148,10 +148,6 @@
     bool shouldDoSameDocumentNavigationTo(HistoryItem& otherItem) const;
     bool hasSameFrames(HistoryItem& otherItem) const;
 
-    WEBCORE_EXPORT void addRedirectURL(const String&);
-    WEBCORE_EXPORT Vector<String>* redirectURLs() const;
-    WEBCORE_EXPORT void setRedirectURLs(std::unique_ptr<Vector<String>>);
-
     bool isCurrentDocument(Document&) const;
     
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebKit/mac/ChangeLog (207481 => 207482)


--- trunk/Source/WebKit/mac/ChangeLog	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-10-18 20:22:58 UTC (rev 207482)
@@ -1,3 +1,21 @@
+2016-10-17  Anders Carlsson  <ander...@apple.com>
+
+        Move some history specific HistoryItem code to WebHistoryItem
+        https://bugs.webkit.org/show_bug.cgi?id=163567
+
+        Reviewed by Tim Horton.
+
+        * History/HistoryPropertyList.mm:
+        (HistoryPropertyListWriter::writeHistoryItem):
+        * History/WebHistory.mm:
+        (-[WebHistory _visitedURL:withTitle:method:wasFailure:]):
+        * History/WebHistoryItem.mm:
+        (-[WebHistoryItem initFromDictionaryRepresentation:]):
+        * History/WebHistoryItemInternal.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (addRedirectURL):
+        (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks):
+
 2016-10-18  Eric Carlson  <eric.carl...@apple.com>
 
         [MediaStream] Resolve constraints and enumerate devices in the UI process

Modified: trunk/Source/WebKit/mac/History/HistoryPropertyList.mm (207481 => 207482)


--- trunk/Source/WebKit/mac/History/HistoryPropertyList.mm	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebKit/mac/History/HistoryPropertyList.mm	2016-10-18 20:22:58 UTC (rev 207482)
@@ -90,7 +90,7 @@
     const String& title = item->title();
     const String& displayTitle = item->alternateTitle();
     double lastVisitedDate = webHistoryItem->_private->_lastVisitedTime;
-    Vector<String>* redirectURLs = item->redirectURLs();
+    Vector<String>* redirectURLs = webHistoryItem->_private->_redirectURLs.get();
 
     // keys
     stream.writeString(m_urlKey);

Modified: trunk/Source/WebKit/mac/History/WebHistory.mm (207481 => 207482)


--- trunk/Source/WebKit/mac/History/WebHistory.mm	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebKit/mac/History/WebHistory.mm	2016-10-18 20:22:58 UTC (rev 207482)
@@ -897,7 +897,7 @@
     HistoryItem* item = core(entry);
     item->setLastVisitWasFailure(wasFailure);
 
-    item->setRedirectURLs(nullptr);
+    entry->_private->_redirectURLs = nullptr;
 
     NSArray *entries = [[NSArray alloc] initWithObjects:entry, nil];
     [self _sendNotification:WebHistoryItemsAddedNotification entries:entries];

Modified: trunk/Source/WebKit/mac/History/WebHistoryItem.mm (207481 => 207482)


--- trunk/Source/WebKit/mac/History/WebHistoryItem.mm	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebKit/mac/History/WebHistoryItem.mm	2016-10-18 20:22:58 UTC (rev 207482)
@@ -354,7 +354,7 @@
             redirectURLsVector->uncheckedAppend((NSString *)redirectURL);
         }
 
-        core(_private)->setRedirectURLs(WTFMove(redirectURLsVector));
+        _private->_redirectURLs = WTFMove(redirectURLsVector);
     }
 
     NSArray *childDicts = [dict objectForKey:childrenKey];
@@ -441,12 +441,12 @@
     }
     if (coreItem->lastVisitWasFailure())
         [dict setObject:[NSNumber numberWithBool:YES] forKey:lastVisitWasFailureKey];
-    if (Vector<String>* redirectURLs = coreItem->redirectURLs()) {
+    if (Vector<String>* redirectURLs = _private->_redirectURLs.get()) {
         size_t size = redirectURLs->size();
         ASSERT(size);
         NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:size];
         for (size_t i = 0; i < size; ++i)
-            [result addObject:(NSString*)redirectURLs->at(i)];
+            [result addObject:(NSString *)redirectURLs->at(i)];
         [dict setObject:result forKey:redirectURLsKey];
         [result release];
     }
@@ -554,7 +554,7 @@
 
 - (NSArray *)_redirectURLs
 {
-    Vector<String>* redirectURLs = core(_private)->redirectURLs();
+    Vector<String>* redirectURLs = _private->_redirectURLs.get();
     if (!redirectURLs)
         return nil;
 

Modified: trunk/Source/WebKit/mac/History/WebHistoryItemInternal.h (207481 => 207482)


--- trunk/Source/WebKit/mac/History/WebHistoryItemInternal.h	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebKit/mac/History/WebHistoryItemInternal.h	2016-10-18 20:22:58 UTC (rev 207482)
@@ -29,6 +29,8 @@
 #import "WebBackForwardList.h"
 #import "WebHistoryItemPrivate.h"
 #import <wtf/RefPtr.h>
+#import <wtf/Vector.h>
+#import <wtf/text/WTFString.h>
 
 namespace WebCore {
     class HistoryItem;
@@ -61,5 +63,6 @@
     RefPtr<WebCore::HistoryItem> _historyItem;
 
     NSTimeInterval _lastVisitedTime;
+    std::unique_ptr<Vector<String>> _redirectURLs;
 }
 @end

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (207481 => 207482)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2016-10-18 20:22:58 UTC (rev 207482)
@@ -1040,6 +1040,17 @@
     [[WebHistory optionalSharedHistory] _visitedURL:loader->urlForHistory() withTitle:loader->title().string() method:loader->originalRequestCopy().httpMethod() wasFailure:loader->urlForHistoryReflectsFailure()];
 }
 
+static void addRedirectURL(WebHistoryItem *item, const String& url)
+{
+    if (!item->_private->_redirectURLs)
+        item->_private->_redirectURLs = std::make_unique<Vector<String>>();
+
+    // Our API allows us to store all the URLs in the redirect chain, but for
+    // now we only have a use for the final URL.
+    item->_private->_redirectURLs->resize(1);
+    item->_private->_redirectURLs->at(0) = url;
+}
+
 void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
 {
     WebView* view = getWebView(m_webFrame.get());
@@ -1055,7 +1066,7 @@
                     m_webFrame->_private->url.get(), loader->clientRedirectDestinationForHistory(), m_webFrame.get());
             }
         } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()])
-            core(item)->addRedirectURL(loader->clientRedirectDestinationForHistory());
+            addRedirectURL(item, loader->clientRedirectDestinationForHistory());
     }
 
     if (!loader->serverRedirectSourceForHistory().isNull()) {
@@ -1065,7 +1076,7 @@
                     loader->serverRedirectSourceForHistory(), loader->serverRedirectDestinationForHistory(), m_webFrame.get());
             }
         } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->serverRedirectSourceForHistory()])
-            core(item)->addRedirectURL(loader->serverRedirectDestinationForHistory());
+            addRedirectURL(item, loader->serverRedirectDestinationForHistory());
     }
 }
 

Modified: trunk/Source/WebKit/win/ChangeLog (207481 => 207482)


--- trunk/Source/WebKit/win/ChangeLog	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebKit/win/ChangeLog	2016-10-18 20:22:58 UTC (rev 207482)
@@ -1,3 +1,20 @@
+2016-10-18  Anders Carlsson  <ander...@apple.com>
+
+        Move some history specific HistoryItem code to WebHistoryItem
+        https://bugs.webkit.org/show_bug.cgi?id=163567
+
+        Reviewed by Tim Horton.
+
+        Remove these, they aren't used.
+
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks):
+        * WebHistory.cpp:
+        (WebHistory::visitedURL):
+        * WebHistoryItem.cpp:
+        (WebHistoryItem::initFromDictionaryRepresentation):
+        (WebHistoryItem::dictionaryRepresentation):
+
 2016-10-16  Darin Adler  <da...@apple.com>
 
         Move CSS classes from ExceptionCode to Exception

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp (207481 => 207482)


--- trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp	2016-10-18 20:22:58 UTC (rev 207482)
@@ -740,13 +740,6 @@
             BString sourceURL(loader->clientRedirectSourceForHistory());
             BString destURL(loader->clientRedirectDestinationForHistory());
             historyDelegate->didPerformClientRedirectFromURL(webView, sourceURL, destURL, m_webFrame);
-        } else {
-            if (history) {
-                if (COMPtr<IWebHistoryItem> iWebHistoryItem = history->itemForURLString(loader->clientRedirectSourceForHistory())) {
-                    COMPtr<WebHistoryItem> webHistoryItem(Query, iWebHistoryItem);
-                    webHistoryItem->historyItem()->addRedirectURL(loader->clientRedirectDestinationForHistory());
-                }
-            }
         }
     }
 
@@ -755,13 +748,6 @@
             BString sourceURL(loader->serverRedirectSourceForHistory());
             BString destURL(loader->serverRedirectDestinationForHistory());
             historyDelegate->didPerformServerRedirectFromURL(webView, sourceURL, destURL, m_webFrame);
-        } else {
-            if (history) {
-                if (COMPtr<IWebHistoryItem> iWebHistoryItem = history->itemForURLString(loader->serverRedirectSourceForHistory())) {
-                    COMPtr<WebHistoryItem> webHistoryItem(Query, iWebHistoryItem);
-                    webHistoryItem->historyItem()->addRedirectURL(loader->serverRedirectDestinationForHistory());
-                }
-            }
         }
     }
 }

Modified: trunk/Source/WebKit/win/WebHistory.cpp (207481 => 207482)


--- trunk/Source/WebKit/win/WebHistory.cpp	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebKit/win/WebHistory.cpp	2016-10-18 20:22:58 UTC (rev 207482)
@@ -522,7 +522,6 @@
     entryPrivate->setLastVisitWasFailure(wasFailure);
 
     COMPtr<WebHistoryItem> item(Query, entry);
-    item->historyItem()->setRedirectURLs(nullptr);
 
     COMPtr<IPropertyBag> userInfo = createUserInfoFromHistoryItem(
         getNotificationString(kWebHistoryItemsAddedNotification), entry);

Modified: trunk/Source/WebKit/win/WebHistoryItem.cpp (207481 => 207482)


--- trunk/Source/WebKit/win/WebHistoryItem.cpp	2016-10-18 20:21:02 UTC (rev 207481)
+++ trunk/Source/WebKit/win/WebHistoryItem.cpp	2016-10-18 20:22:58 UTC (rev 207482)
@@ -124,9 +124,6 @@
     if (lastVisitWasFailure)
         m_historyItem->setLastVisitWasFailure(true);
 
-    if (redirectURLsVector.get())
-        m_historyItem->setRedirectURLs(WTFMove(redirectURLsVector));
-
     return S_OK;
 }
 
@@ -156,22 +153,6 @@
         ++keyCount;
     }
 
-    if (Vector<String>* redirectURLs = m_historyItem->redirectURLs()) {
-        size_t size = redirectURLs->size();
-        ASSERT(size);
-        CFStringRef* items = new CFStringRef[size];
-        for (size_t i = 0; i < size; ++i)
-            items[i] = redirectURLs->at(i).createCFString().leakRef();
-        CFArrayRef result = CFArrayCreate(0, (const void**)items, size, &kCFTypeArrayCallBacks);
-        for (size_t i = 0; i < size; ++i)
-            CFRelease(items[i]);
-        delete[] items;
-
-        keys[keyCount] = redirectURLsKey;
-        values[keyCount] = result;
-        ++keyCount;
-    }
-
     *dictionaryRef = CFDictionaryCreate(0, keys, values, keyCount, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
     
     for (int i = 0; i < keyCount; ++i)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to