Changeset 176575 in webkit
- Timestamp:
- Nov 29, 2014, 1:49:40 PM (12 years ago)
- Location:
- trunk/Source/WebKit/mac
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
History/WebHistory.mm (modified) (2 diffs)
-
WebCoreSupport/WebVisitedLinkStore.h (modified) (3 diffs)
-
WebCoreSupport/WebVisitedLinkStore.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/mac/ChangeLog
r176551 r176575 1 2014-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 1 37 2014-11-27 Anders Carlsson <andersca@apple.com> 2 38 -
trunk/Source/WebKit/mac/History/WebHistory.mm
r176347 r176575 34 34 #import "WebNSURLExtras.h" 35 35 #import "WebTypesInternal.h" 36 #import "WebVisitedLinkStore.h" 36 37 #import <WebCore/HistoryItem.h> 37 38 #import <WebCore/NSCalendarDateSPI.h> … … 728 729 [_sharedHistory release]; 729 730 _sharedHistory = [history retain]; 731 730 732 PageGroup::setShouldTrackVisitedLinks(history); 731 733 PageGroup::removeAllVisitedLinks(); 734 WebVisitedLinkStore::setShouldTrackVisitedLinks(history); 735 WebVisitedLinkStore::removeAllVisitedLinks(); 732 736 } 733 737 -
trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.h
r176551 r176575 27 27 #define WebVisitedLinkStore_h 28 28 29 #import <WebCore/LinkHash.h> 29 30 #import <WebCore/VisitedLinkStore.h> 30 31 #import <wtf/PassRef.h> … … 35 36 virtual ~WebVisitedLinkStore(); 36 37 38 static void setShouldTrackVisitedLinks(bool); 39 static void removeAllVisitedLinks(); 40 37 41 private: 38 42 WebVisitedLinkStore(); … … 40 44 virtual bool isLinkVisited(WebCore::Page&, WebCore::LinkHash, const WebCore::URL& baseURL, const AtomicString& attributeURL) override; 41 45 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; 42 52 }; 43 53 -
trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.mm
r176551 r176575 26 26 #import "WebVisitedLinkStore.h" 27 27 28 #import <WebCore/PageCache.h> 29 #import <wtf/NeverDestroyed.h> 30 31 using namespace WebCore; 32 33 static bool s_shouldTrackVisitedLinks; 34 35 static HashSet<WebVisitedLinkStore*>& visitedLinkStores() 36 { 37 static NeverDestroyed<HashSet<WebVisitedLinkStore*>> visitedLinkStores; 38 39 return visitedLinkStores; 40 } 41 42 28 43 PassRef<WebVisitedLinkStore> WebVisitedLinkStore::create() 29 44 { … … 32 47 33 48 WebVisitedLinkStore::WebVisitedLinkStore() 49 : m_visitedLinksPopulated(false) 34 50 { 51 visitedLinkStores().add(this); 35 52 } 36 53 37 54 WebVisitedLinkStore::~WebVisitedLinkStore() 38 55 { 56 visitedLinkStores().remove(this); 39 57 } 40 58 41 bool WebVisitedLinkStore::isLinkVisited(WebCore::Page&, WebCore::LinkHash, const WebCore::URL& baseURL, const AtomicString& attributeURL)59 void WebVisitedLinkStore::setShouldTrackVisitedLinks(bool shouldTrackVisitedLinks) 42 60 { 43 // FIXME: Implement. 44 return false; 61 if (s_shouldTrackVisitedLinks == shouldTrackVisitedLinks) 62 return; 63 s_shouldTrackVisitedLinks = shouldTrackVisitedLinks; 64 if (!s_shouldTrackVisitedLinks) 65 removeAllVisitedLinks(); 45 66 } 46 67 47 void WebVisitedLinkStore:: addVisitedLink(WebCore::Page&, WebCore::LinkHash)68 void WebVisitedLinkStore::removeAllVisitedLinks() 48 69 { 49 // FIXME: Implement. 70 for (auto& visitedLinkStore : visitedLinkStores()) 71 visitedLinkStore->removeVisitedLinkHashes(); 72 pageCache()->markPagesForVistedLinkStyleRecalc(); 50 73 } 74 75 bool WebVisitedLinkStore::isLinkVisited(Page& page, LinkHash linkHash, const URL& baseURL, const AtomicString& attributeURL) 76 { 77 return m_visitedLinkHashes.contains(linkHash); 78 } 79 80 void 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 90 void WebVisitedLinkStore::populateVisitedLinksIfNeeded(Page&) 91 { 92 if (m_visitedLinksPopulated) 93 return; 94 95 m_visitedLinksPopulated = true; 96 97 // FIXME: Populate visited links. 98 } 99 100 void 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.