Title: [168317] trunk/Source/WebKit2
Revision
168317
Author
commit-qu...@webkit.org
Date
2014-05-05 14:23:37 -0700 (Mon, 05 May 2014)

Log Message

[Cocoa WebKit2] Add SPI to clear all visited links in a VisitedLinkProvider
https://bugs.webkit.org/show_bug.cgi?id=132573

Patch by Sam Weinig <s...@webkit.org> on 2014-05-05
Reviewed by Dan Bernstein.

* Shared/VisitedLinkTable.cpp:
(WebKit::VisitedLinkTable::VisitedLinkTable):
(WebKit::VisitedLinkTable::clear):
* Shared/VisitedLinkTable.h:
Add functions to clear the visited link table.

* UIProcess/API/Cocoa/_WKVisitedLinkProvider.h:
* UIProcess/API/Cocoa/_WKVisitedLinkProvider.mm:
(-[_WKVisitedLinkProvider removeAll]):
Add SPI.

* UIProcess/VisitedLinkProvider.cpp:
(WebKit::VisitedLinkProvider::removeAll):
* UIProcess/VisitedLinkProvider.h:
A remove all resets the provider and notifies all the attached processes.

* WebProcess/WebPage/VisitedLinkTableController.cpp:
(WebKit::VisitedLinkTableController::removeAllVisitedLinks):
* WebProcess/WebPage/VisitedLinkTableController.h:
* WebProcess/WebPage/VisitedLinkTableController.messages.in:
Add message to clear the visited links for a process.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (168316 => 168317)


--- trunk/Source/WebKit2/ChangeLog	2014-05-05 21:13:22 UTC (rev 168316)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-05 21:23:37 UTC (rev 168317)
@@ -1,3 +1,32 @@
+2014-05-05  Sam Weinig  <s...@webkit.org>
+
+        [Cocoa WebKit2] Add SPI to clear all visited links in a VisitedLinkProvider
+        https://bugs.webkit.org/show_bug.cgi?id=132573
+
+        Reviewed by Dan Bernstein.
+
+        * Shared/VisitedLinkTable.cpp:
+        (WebKit::VisitedLinkTable::VisitedLinkTable):
+        (WebKit::VisitedLinkTable::clear):
+        * Shared/VisitedLinkTable.h:
+        Add functions to clear the visited link table.
+
+        * UIProcess/API/Cocoa/_WKVisitedLinkProvider.h:
+        * UIProcess/API/Cocoa/_WKVisitedLinkProvider.mm:
+        (-[_WKVisitedLinkProvider removeAll]):
+        Add SPI.
+
+        * UIProcess/VisitedLinkProvider.cpp:
+        (WebKit::VisitedLinkProvider::removeAll):
+        * UIProcess/VisitedLinkProvider.h:
+        A remove all resets the provider and notifies all the attached processes.
+
+        * WebProcess/WebPage/VisitedLinkTableController.cpp:
+        (WebKit::VisitedLinkTableController::removeAllVisitedLinks):
+        * WebProcess/WebPage/VisitedLinkTableController.h:
+        * WebProcess/WebPage/VisitedLinkTableController.messages.in:
+        Add message to clear the visited links for a process.
+
 2014-05-05  Benjamin Poulain  <benja...@webkit.org>
 
         [iOS][WK2] Special case ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture() for image documents

Modified: trunk/Source/WebKit2/Shared/VisitedLinkTable.cpp (168316 => 168317)


--- trunk/Source/WebKit2/Shared/VisitedLinkTable.cpp	2014-05-05 21:13:22 UTC (rev 168316)
+++ trunk/Source/WebKit2/Shared/VisitedLinkTable.cpp	2014-05-05 21:23:37 UTC (rev 168317)
@@ -34,7 +34,8 @@
 
 VisitedLinkTable::VisitedLinkTable()
     : m_tableSize(0)
-    , m_table(0)
+    , m_tableSizeMask(0)
+    , m_table(nullptr)
 {
 }
 
@@ -136,4 +137,11 @@
     return false;
 }
 
+void VisitedLinkTable::clear()
+{
+    m_tableSize = 0;
+    m_tableSizeMask = 0;
+    m_sharedMemory = nullptr;
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/Shared/VisitedLinkTable.h (168316 => 168317)


--- trunk/Source/WebKit2/Shared/VisitedLinkTable.h	2014-05-05 21:13:22 UTC (rev 168316)
+++ trunk/Source/WebKit2/Shared/VisitedLinkTable.h	2014-05-05 21:23:37 UTC (rev 168317)
@@ -47,6 +47,7 @@
     bool isLinkVisited(WebCore::LinkHash) const;
 
     SharedMemory* sharedMemory() const { return m_sharedMemory.get(); }
+    void clear();
 
 private:
     RefPtr<SharedMemory> m_sharedMemory;

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKVisitedLinkProvider.h (168316 => 168317)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKVisitedLinkProvider.h	2014-05-05 21:13:22 UTC (rev 168316)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKVisitedLinkProvider.h	2014-05-05 21:23:37 UTC (rev 168317)
@@ -32,6 +32,7 @@
 @interface _WKVisitedLinkProvider : NSObject
 
 - (void)addVisitedLinkWithURL:(NSURL *)URL;
+- (void)removeAll;
 
 @end
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKVisitedLinkProvider.mm (168316 => 168317)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKVisitedLinkProvider.mm	2014-05-05 21:13:22 UTC (rev 168316)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKVisitedLinkProvider.mm	2014-05-05 21:23:37 UTC (rev 168317)
@@ -50,6 +50,11 @@
     _visitedLinkProvider->addVisitedLinkHash(linkHash);
 }
 
+- (void)removeAll
+{
+    _visitedLinkProvider->removeAll();
+}
+
 @end
 
 #endif

Modified: trunk/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp (168316 => 168317)


--- trunk/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp	2014-05-05 21:13:22 UTC (rev 168316)
+++ trunk/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp	2014-05-05 21:23:37 UTC (rev 168317)
@@ -89,6 +89,18 @@
         process.removeMessageReceiver(Messages::VisitedLinkProvider::messageReceiverName(), m_identifier);
 }
 
+void VisitedLinkProvider::removeAll()
+{
+    m_pendingVisitedLinksTimer.stop();
+    m_pendingVisitedLinks.clear();
+    m_keyCount = 0;
+    m_tableSize = 0;
+    m_table.clear();
+
+    for (auto& processAndCount : m_processes)
+        processAndCount.key->connection()->send(Messages::VisitedLinkTableController::RemoveAllVisitedLinks(), m_identifier);
+}
+
 void VisitedLinkProvider::addVisitedLinkHash(LinkHash linkHash)
 {
     m_pendingVisitedLinks.add(linkHash);

Modified: trunk/Source/WebKit2/UIProcess/VisitedLinkProvider.h (168316 => 168317)


--- trunk/Source/WebKit2/UIProcess/VisitedLinkProvider.h	2014-05-05 21:13:22 UTC (rev 168316)
+++ trunk/Source/WebKit2/UIProcess/VisitedLinkProvider.h	2014-05-05 21:23:37 UTC (rev 168317)
@@ -52,6 +52,7 @@
     void removeProcess(WebProcessProxy&);
 
     void addVisitedLinkHash(WebCore::LinkHash);
+    void removeAll();
 
 private:
     VisitedLinkProvider();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.cpp (168316 => 168317)


--- trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.cpp	2014-05-05 21:13:22 UTC (rev 168316)
+++ trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.cpp	2014-05-05 21:23:37 UTC (rev 168317)
@@ -113,4 +113,12 @@
     pageCache()->markPagesForVistedLinkStyleRecalc();
 }
 
+void VisitedLinkTableController::removeAllVisitedLinks()
+{
+    m_visitedLinkTable.clear();
+
+    invalidateStylesForAllLinks();
+    pageCache()->markPagesForVistedLinkStyleRecalc();
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.h (168316 => 168317)


--- trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.h	2014-05-05 21:13:22 UTC (rev 168316)
+++ trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.h	2014-05-05 21:23:37 UTC (rev 168317)
@@ -51,6 +51,7 @@
     void setVisitedLinkTable(const SharedMemory::Handle&);
     void visitedLinkStateChanged(const Vector<WebCore::LinkHash>&);
     void allVisitedLinkStateChanged();
+    void removeAllVisitedLinks();
 
     uint64_t m_identifier;
     VisitedLinkTable m_visitedLinkTable;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.messages.in (168316 => 168317)


--- trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.messages.in	2014-05-05 21:13:22 UTC (rev 168316)
+++ trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.messages.in	2014-05-05 21:23:37 UTC (rev 168317)
@@ -24,4 +24,5 @@
     SetVisitedLinkTable(WebKit::SharedMemory::Handle handle)
     VisitedLinkStateChanged(Vector<WebCore::LinkHash> linkHashes)
     AllVisitedLinkStateChanged()
+    RemoveAllVisitedLinks()
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to