⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 176575 in webkit


Ignore:
Timestamp:
Nov 29, 2014, 1:49:40 PM (12 years ago)
Author:
andersca@apple.com
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.

Location:
trunk/Source/WebKit/mac
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r176551 r176575  
     12014-11-29  Anders Carlsson  <andersca@apple.com>
     2
     3        More work on the legacy WebKit visited link store
     4        https://bugs.webkit.org/show_bug.cgi?id=139100
     5
     6        Reviewed by Sam Weinig.
     7
     8        * History/WebHistory.mm:
     9        (+[WebHistory setOptionalSharedHistory:]):
     10        Call WebVisitedLinkStore::setShouldTrackVisitedLinks and WebVisitedLinkStore::removeAllVisitedLinks.
     11
     12        * WebCoreSupport/WebVisitedLinkStore.h:
     13        * WebCoreSupport/WebVisitedLinkStore.mm:
     14        (visitedLinkStores):
     15        (WebVisitedLinkStore::WebVisitedLinkStore):
     16        (WebVisitedLinkStore::~WebVisitedLinkStore):
     17        Keep track of live visited link stores.
     18
     19        (WebVisitedLinkStore::setShouldTrackVisitedLinks):
     20        Update s_shouldTrackVisitedLinks and call removeAllVisitedLinks if necessary.
     21
     22        (WebVisitedLinkStore::removeAllVisitedLinks):
     23        Iterate over all live link stores and remove their links.
     24
     25        (WebVisitedLinkStore::isLinkVisited):
     26        Populate visited links and check if our hash table contains the link.
     27
     28        (WebVisitedLinkStore::addVisitedLink):
     29        Add the link hash to the table.
     30
     31        (WebVisitedLinkStore::populateVisitedLinksIfNeeded):
     32        Add stub.
     33
     34        (WebVisitedLinkStore::removeVisitedLinkHashes):
     35        Clear out the hash table.
     36
    1372014-11-27  Anders Carlsson  <andersca@apple.com>
    238
  • trunk/Source/WebKit/mac/History/WebHistory.mm

    r176347 r176575  
    3434#import "WebNSURLExtras.h"
    3535#import "WebTypesInternal.h"
     36#import "WebVisitedLinkStore.h"
    3637#import <WebCore/HistoryItem.h>
    3738#import <WebCore/NSCalendarDateSPI.h>
     
    728729    [_sharedHistory release];
    729730    _sharedHistory = [history retain];
     731
    730732    PageGroup::setShouldTrackVisitedLinks(history);
    731733    PageGroup::removeAllVisitedLinks();
     734    WebVisitedLinkStore::setShouldTrackVisitedLinks(history);
     735    WebVisitedLinkStore::removeAllVisitedLinks();
    732736}
    733737
  • trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.h

    r176551 r176575  
    2727#define WebVisitedLinkStore_h
    2828
     29#import <WebCore/LinkHash.h>
    2930#import <WebCore/VisitedLinkStore.h>
    3031#import <wtf/PassRef.h>
     
    3536    virtual ~WebVisitedLinkStore();
    3637
     38    static void setShouldTrackVisitedLinks(bool);
     39    static void removeAllVisitedLinks();
     40
    3741private:
    3842    WebVisitedLinkStore();
     
    4044    virtual bool isLinkVisited(WebCore::Page&, WebCore::LinkHash, const WebCore::URL& baseURL, const AtomicString& attributeURL) override;
    4145    virtual void addVisitedLink(WebCore::Page&, WebCore::LinkHash) override;
     46
     47    void populateVisitedLinksIfNeeded(WebCore::Page&);
     48    void removeVisitedLinkHashes();
     49
     50    HashSet<WebCore::LinkHash, WebCore::LinkHashHash> m_visitedLinkHashes;
     51    bool m_visitedLinksPopulated;
    4252};
    4353
  • trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.mm

    r176551 r176575  
    2626#import "WebVisitedLinkStore.h"
    2727
     28#import <WebCore/PageCache.h>
     29#import <wtf/NeverDestroyed.h>
     30
     31using namespace WebCore;
     32
     33static bool s_shouldTrackVisitedLinks;
     34
     35static HashSet<WebVisitedLinkStore*>& visitedLinkStores()
     36{
     37    static NeverDestroyed<HashSet<WebVisitedLinkStore*>> visitedLinkStores;
     38
     39    return visitedLinkStores;
     40}
     41
     42
    2843PassRef<WebVisitedLinkStore> WebVisitedLinkStore::create()
    2944{
     
    3247
    3348WebVisitedLinkStore::WebVisitedLinkStore()
     49    : m_visitedLinksPopulated(false)
    3450{
     51    visitedLinkStores().add(this);
    3552}
    3653
    3754WebVisitedLinkStore::~WebVisitedLinkStore()
    3855{
     56    visitedLinkStores().remove(this);
    3957}
    4058
    41 bool WebVisitedLinkStore::isLinkVisited(WebCore::Page&, WebCore::LinkHash, const WebCore::URL& baseURL, const AtomicString& attributeURL)
     59void WebVisitedLinkStore::setShouldTrackVisitedLinks(bool shouldTrackVisitedLinks)
    4260{
    43     // FIXME: Implement.
    44     return false;
     61    if (s_shouldTrackVisitedLinks == shouldTrackVisitedLinks)
     62        return;
     63    s_shouldTrackVisitedLinks = shouldTrackVisitedLinks;
     64    if (!s_shouldTrackVisitedLinks)
     65        removeAllVisitedLinks();
    4566}
    4667
    47 void WebVisitedLinkStore::addVisitedLink(WebCore::Page&, WebCore::LinkHash)
     68void WebVisitedLinkStore::removeAllVisitedLinks()
    4869{
    49     // FIXME: Implement.
     70    for (auto& visitedLinkStore : visitedLinkStores())
     71        visitedLinkStore->removeVisitedLinkHashes();
     72    pageCache()->markPagesForVistedLinkStyleRecalc();
    5073}
     74
     75bool WebVisitedLinkStore::isLinkVisited(Page& page, LinkHash linkHash, const URL& baseURL, const AtomicString& attributeURL)
     76{
     77    return m_visitedLinkHashes.contains(linkHash);
     78}
     79
     80void WebVisitedLinkStore::addVisitedLink(Page& sourcePage, LinkHash linkHash)
     81{
     82    ASSERT(s_shouldTrackVisitedLinks);
     83
     84    m_visitedLinkHashes.add(linkHash);
     85
     86    invalidateStylesForLink(linkHash);
     87    pageCache()->markPagesForVistedLinkStyleRecalc();
     88}
     89
     90void WebVisitedLinkStore::populateVisitedLinksIfNeeded(Page&)
     91{
     92    if (m_visitedLinksPopulated)
     93        return;
     94
     95    m_visitedLinksPopulated = true;
     96
     97    // FIXME: Populate visited links.
     98}
     99
     100void WebVisitedLinkStore::removeVisitedLinkHashes()
     101{
     102    m_visitedLinksPopulated = false;
     103    if (m_visitedLinkHashes.isEmpty())
     104        return;
     105    m_visitedLinkHashes.clear();
     106
     107    invalidateStylesForAllLinks();
     108}
Note: See TracChangeset for help on using the changeset viewer.