Title: [176575] trunk/Source/WebKit/mac
- Revision
- 176575
- Author
- [email protected]
- Date
- 2014-11-29 13:49:40 -0800 (Sat, 29 Nov 2014)
Log Message
More work on the legacy WebKit visited link store
https://bugs.webkit.org/show_bug.cgi?id=139100
Reviewed by Sam Weinig.
* History/WebHistory.mm:
(+[WebHistory setOptionalSharedHistory:]):
Call WebVisitedLinkStore::setShouldTrackVisitedLinks and WebVisitedLinkStore::removeAllVisitedLinks.
* WebCoreSupport/WebVisitedLinkStore.h:
* WebCoreSupport/WebVisitedLinkStore.mm:
(visitedLinkStores):
(WebVisitedLinkStore::WebVisitedLinkStore):
(WebVisitedLinkStore::~WebVisitedLinkStore):
Keep track of live visited link stores.
(WebVisitedLinkStore::setShouldTrackVisitedLinks):
Update s_shouldTrackVisitedLinks and call removeAllVisitedLinks if necessary.
(WebVisitedLinkStore::removeAllVisitedLinks):
Iterate over all live link stores and remove their links.
(WebVisitedLinkStore::isLinkVisited):
Populate visited links and check if our hash table contains the link.
(WebVisitedLinkStore::addVisitedLink):
Add the link hash to the table.
(WebVisitedLinkStore::populateVisitedLinksIfNeeded):
Add stub.
(WebVisitedLinkStore::removeVisitedLinkHashes):
Clear out the hash table.
Modified Paths
Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (176574 => 176575)
--- trunk/Source/WebKit/mac/ChangeLog 2014-11-29 21:12:55 UTC (rev 176574)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-11-29 21:49:40 UTC (rev 176575)
@@ -1,3 +1,39 @@
+2014-11-29 Anders Carlsson <[email protected]>
+
+ More work on the legacy WebKit visited link store
+ https://bugs.webkit.org/show_bug.cgi?id=139100
+
+ Reviewed by Sam Weinig.
+
+ * History/WebHistory.mm:
+ (+[WebHistory setOptionalSharedHistory:]):
+ Call WebVisitedLinkStore::setShouldTrackVisitedLinks and WebVisitedLinkStore::removeAllVisitedLinks.
+
+ * WebCoreSupport/WebVisitedLinkStore.h:
+ * WebCoreSupport/WebVisitedLinkStore.mm:
+ (visitedLinkStores):
+ (WebVisitedLinkStore::WebVisitedLinkStore):
+ (WebVisitedLinkStore::~WebVisitedLinkStore):
+ Keep track of live visited link stores.
+
+ (WebVisitedLinkStore::setShouldTrackVisitedLinks):
+ Update s_shouldTrackVisitedLinks and call removeAllVisitedLinks if necessary.
+
+ (WebVisitedLinkStore::removeAllVisitedLinks):
+ Iterate over all live link stores and remove their links.
+
+ (WebVisitedLinkStore::isLinkVisited):
+ Populate visited links and check if our hash table contains the link.
+
+ (WebVisitedLinkStore::addVisitedLink):
+ Add the link hash to the table.
+
+ (WebVisitedLinkStore::populateVisitedLinksIfNeeded):
+ Add stub.
+
+ (WebVisitedLinkStore::removeVisitedLinkHashes):
+ Clear out the hash table.
+
2014-11-27 Anders Carlsson <[email protected]>
Add a stubbed out WebVisitedLinkStore to WebViewGroup
Modified: trunk/Source/WebKit/mac/History/WebHistory.mm (176574 => 176575)
--- trunk/Source/WebKit/mac/History/WebHistory.mm 2014-11-29 21:12:55 UTC (rev 176574)
+++ trunk/Source/WebKit/mac/History/WebHistory.mm 2014-11-29 21:49:40 UTC (rev 176575)
@@ -33,6 +33,7 @@
#import "WebKitLogging.h"
#import "WebNSURLExtras.h"
#import "WebTypesInternal.h"
+#import "WebVisitedLinkStore.h"
#import <WebCore/HistoryItem.h>
#import <WebCore/NSCalendarDateSPI.h>
#import <WebCore/PageGroup.h>
@@ -727,8 +728,11 @@
// and correct synchronization of history file between applications.
[_sharedHistory release];
_sharedHistory = [history retain];
+
PageGroup::setShouldTrackVisitedLinks(history);
PageGroup::removeAllVisitedLinks();
+ WebVisitedLinkStore::setShouldTrackVisitedLinks(history);
+ WebVisitedLinkStore::removeAllVisitedLinks();
}
- (void)timeZoneChanged:(NSNotification *)notification
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.h (176574 => 176575)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.h 2014-11-29 21:12:55 UTC (rev 176574)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.h 2014-11-29 21:49:40 UTC (rev 176575)
@@ -26,6 +26,7 @@
#ifndef WebVisitedLinkStore_h
#define WebVisitedLinkStore_h
+#import <WebCore/LinkHash.h>
#import <WebCore/VisitedLinkStore.h>
#import <wtf/PassRef.h>
@@ -34,11 +35,20 @@
static PassRef<WebVisitedLinkStore> create();
virtual ~WebVisitedLinkStore();
+ static void setShouldTrackVisitedLinks(bool);
+ static void removeAllVisitedLinks();
+
private:
WebVisitedLinkStore();
virtual bool isLinkVisited(WebCore::Page&, WebCore::LinkHash, const WebCore::URL& baseURL, const AtomicString& attributeURL) override;
virtual void addVisitedLink(WebCore::Page&, WebCore::LinkHash) override;
+
+ void populateVisitedLinksIfNeeded(WebCore::Page&);
+ void removeVisitedLinkHashes();
+
+ HashSet<WebCore::LinkHash, WebCore::LinkHashHash> m_visitedLinkHashes;
+ bool m_visitedLinksPopulated;
};
#endif // WebVisitedLinkStore_h
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.mm (176574 => 176575)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.mm 2014-11-29 21:12:55 UTC (rev 176574)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.mm 2014-11-29 21:49:40 UTC (rev 176575)
@@ -25,26 +25,84 @@
#import "WebVisitedLinkStore.h"
+#import <WebCore/PageCache.h>
+#import <wtf/NeverDestroyed.h>
+
+using namespace WebCore;
+
+static bool s_shouldTrackVisitedLinks;
+
+static HashSet<WebVisitedLinkStore*>& visitedLinkStores()
+{
+ static NeverDestroyed<HashSet<WebVisitedLinkStore*>> visitedLinkStores;
+
+ return visitedLinkStores;
+}
+
+
PassRef<WebVisitedLinkStore> WebVisitedLinkStore::create()
{
return adoptRef(*new WebVisitedLinkStore);
}
WebVisitedLinkStore::WebVisitedLinkStore()
+ : m_visitedLinksPopulated(false)
{
+ visitedLinkStores().add(this);
}
WebVisitedLinkStore::~WebVisitedLinkStore()
{
+ visitedLinkStores().remove(this);
}
-bool WebVisitedLinkStore::isLinkVisited(WebCore::Page&, WebCore::LinkHash, const WebCore::URL& baseURL, const AtomicString& attributeURL)
+void WebVisitedLinkStore::setShouldTrackVisitedLinks(bool shouldTrackVisitedLinks)
{
- // FIXME: Implement.
- return false;
+ if (s_shouldTrackVisitedLinks == shouldTrackVisitedLinks)
+ return;
+ s_shouldTrackVisitedLinks = shouldTrackVisitedLinks;
+ if (!s_shouldTrackVisitedLinks)
+ removeAllVisitedLinks();
}
-void WebVisitedLinkStore::addVisitedLink(WebCore::Page&, WebCore::LinkHash)
+void WebVisitedLinkStore::removeAllVisitedLinks()
{
- // FIXME: Implement.
+ for (auto& visitedLinkStore : visitedLinkStores())
+ visitedLinkStore->removeVisitedLinkHashes();
+ pageCache()->markPagesForVistedLinkStyleRecalc();
}
+
+bool WebVisitedLinkStore::isLinkVisited(Page& page, LinkHash linkHash, const URL& baseURL, const AtomicString& attributeURL)
+{
+ return m_visitedLinkHashes.contains(linkHash);
+}
+
+void WebVisitedLinkStore::addVisitedLink(Page& sourcePage, LinkHash linkHash)
+{
+ ASSERT(s_shouldTrackVisitedLinks);
+
+ m_visitedLinkHashes.add(linkHash);
+
+ invalidateStylesForLink(linkHash);
+ pageCache()->markPagesForVistedLinkStyleRecalc();
+}
+
+void WebVisitedLinkStore::populateVisitedLinksIfNeeded(Page&)
+{
+ if (m_visitedLinksPopulated)
+ return;
+
+ m_visitedLinksPopulated = true;
+
+ // FIXME: Populate visited links.
+}
+
+void WebVisitedLinkStore::removeVisitedLinkHashes()
+{
+ m_visitedLinksPopulated = false;
+ if (m_visitedLinkHashes.isEmpty())
+ return;
+ m_visitedLinkHashes.clear();
+
+ invalidateStylesForAllLinks();
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes