Changeset 64775 in webkit


Ignore:
Timestamp:
Aug 5, 2010 12:54:13 PM (14 years ago)
Author:
andersca@apple.com
Message:

Add VisitedLinkProvider class
https://bugs.webkit.org/show_bug.cgi?id=43570

Reviewed by Sam Weinig.

  • Shared/CoreIPCSupport/WebProcessMessageKinds.h:

(WebProcessMessage::):
Add SetVisitedLinkTable, VisitedLinkStateChanged and AllVisitedLinkStateChanged.

  • UIProcess/VisitedLinkProvider.cpp: Added.

(WebKit::VisitedLinkProvider::VisitedLinkProvider):
Initialize table.

(WebKit::VisitedLinkProvider::populateVisitedLinksIfNeeded):
Ask the context to populate visited links.

(WebKit::VisitedLinkProvider::addVisitedLink):
Add the link hash to the set of pending visited links and start the timer.

(WebKit::nextPowerOf2):
Add helper function.

(WebKit::tableSizeForKeyCount):
Given a key count, returns a table size. The table size is always a power of two, and
is chosen so that the table is always at least half empty.

(WebKit::VisitedLinkProvider::pendingVisitedLinksTimerFired):
First, check if we need to resize the hash table and allocate new shared memory for it if that is the case.
Then, go through the pending link hash vector and insert all the elements in the table. Finally, notify the web
process about visited links whose state have changed.

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::didReceiveMessage):
Add case statements.

  • win/WebKit2.vcproj:
  • WebKit2.xcodeproj/project.pbxproj:

Add VisitedLinkProvider.cpp and VisitedLinkProvider.h.

Location:
trunk/WebKit2
Files:
1 added
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r64768 r64775  
     12010-08-05  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Add VisitedLinkProvider class
     6        https://bugs.webkit.org/show_bug.cgi?id=43570
     7
     8        * Shared/CoreIPCSupport/WebProcessMessageKinds.h:
     9        (WebProcessMessage::):
     10        Add SetVisitedLinkTable, VisitedLinkStateChanged and AllVisitedLinkStateChanged.
     11
     12        * UIProcess/VisitedLinkProvider.cpp: Added.
     13        (WebKit::VisitedLinkProvider::VisitedLinkProvider):
     14        Initialize table.
     15
     16        (WebKit::VisitedLinkProvider::populateVisitedLinksIfNeeded):
     17        Ask the context to populate visited links.
     18
     19        (WebKit::VisitedLinkProvider::addVisitedLink):
     20        Add the link hash to the set of pending visited links and start the timer.
     21
     22        (WebKit::nextPowerOf2):
     23        Add helper function.
     24
     25        (WebKit::tableSizeForKeyCount):
     26        Given a key count, returns a table size. The table size is always a power of two, and
     27        is chosen so that the table is always at least half empty.
     28
     29        (WebKit::VisitedLinkProvider::pendingVisitedLinksTimerFired):
     30        First, check if we need to resize the hash table and allocate new shared memory for it if that is the case.
     31        Then, go through the pending link hash vector and insert all the elements in the table. Finally, notify the web
     32        process about visited links whose state have changed.
     33
     34        * WebProcess/WebProcess.cpp:
     35        (WebKit::WebProcess::didReceiveMessage):
     36        Add case statements.
     37
     38        * win/WebKit2.vcproj:
     39        * WebKit2.xcodeproj/project.pbxproj:
     40        Add VisitedLinkProvider.cpp and VisitedLinkProvider.h.
     41
    1422010-08-05  Anders Carlsson  <andersca@apple.com>
    243
  • trunk/WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h

    r64492 r64775  
    3434
    3535enum Kind {
     36    SetVisitedLinkTable,
     37    VisitedLinkStateChanged,
     38    AllVisitedLinkStateChanged,
     39   
     40    // FIXME: Remove AddVisitedLink.
    3641    AddVisitedLink,
    3742    LoadInjectedBundle,
  • trunk/WebKit2/UIProcess/VisitedLinkProvider.h

    r64768 r64775  
    2424 */
    2525
    26 #ifndef WebProcessMessageKinds_h
    27 #define WebProcessMessageKinds_h
     26#ifndef VisitedLinkProvider_h
     27#define VisitedLinkProvider_h
    2828
    29 // Messages sent from WebKit to the web process.
     29#include "RunLoop.h"
     30#include "VisitedLinkTable.h"
     31#include <WebCore/LinkHash.h>
     32#include <wtf/HashSet.h>
     33#include <wtf/Noncopyable.h>
    3034
    31 #include "MessageID.h"
     35namespace WebCore {
     36    class String;
     37}
    3238
    33 namespace WebProcessMessage {
     39namespace WebKit {
    3440
    35 enum Kind {
    36     AddVisitedLink,
    37     LoadInjectedBundle,
    38     SetApplicationCacheDirectory,
    39     SetShouldTrackVisitedLinks,
    40     Create,
    41     RegisterURLSchemeAsEmptyDocument,
    42 #if PLATFORM(MAC)
    43     SetupAcceleratedCompositingPort
    44 #endif
     41class WebContext;
     42   
     43class VisitedLinkProvider : Noncopyable {
     44public:
     45    explicit VisitedLinkProvider(WebContext*);
     46
     47    void populateVisitedLinksIfNeeded();
     48    void addVisitedLink(WebCore::LinkHash);
     49
     50private:
     51    void pendingVisitedLinksTimerFired();
     52
     53    WebContext* m_context;
     54    bool m_visitedLinksPopulated;
     55
     56    unsigned m_keyCount;
     57    unsigned m_tableSize;
     58    VisitedLinkTable m_table;
     59
     60    HashSet<WebCore::LinkHash, WebCore::LinkHashHash> m_pendingVisitedLinks;
     61    RunLoop::Timer<VisitedLinkProvider> m_pendingVisitedLinksTimer;
    4562};
    4663
    47 }
     64} // namespace WebKit
    4865
    49 namespace CoreIPC {
    50 
    51 template<> struct MessageKindTraits<WebProcessMessage::Kind> {
    52     static const MessageClass messageClass = MessageClassWebProcess;
    53 };
    54 
    55 }
    56 
    57 #endif // WebProcessMessageKinds_h
     66#endif // VisitedLinkProvider_h
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r64768 r64775  
    3535                1A0F29CB120B37160053D1B9 /* VisitedLinkTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */; };
    3636                1A0F29CC120B37160053D1B9 /* VisitedLinkTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */; };
     37                1A0F29E3120B44420053D1B9 /* VisitedLinkProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */; };
     38                1A0F29E4120B44420053D1B9 /* VisitedLinkProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */; };
    3739                1A10475A110A5AD500A43ECD /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */; };
    3840                1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; };
     
    345347                1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkTable.cpp; sourceTree = "<group>"; };
    346348                1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkTable.h; sourceTree = "<group>"; };
     349                1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkProvider.cpp; sourceTree = "<group>"; };
     350                1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkProvider.h; sourceTree = "<group>"; };
    347351                1A1C648611F415B700553C19 /* WebContextMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMac.mm; sourceTree = "<group>"; };
    348352                1A2161AE11F37664008AD0F5 /* NPRuntimeObjectMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPRuntimeObjectMap.h; sourceTree = "<group>"; };
     
    950954                                BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */,
    951955                                1A30066C1110F4F70031937C /* ResponsivenessTimer.h */,
     956                                1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */,
     957                                1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */,
    952958                                BC72BA1B11E64907001EB4EA /* WebBackForwardList.cpp */,
    953959                                BC72BA1C11E64907001EB4EA /* WebBackForwardList.h */,
     
    13901396                                1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */,
    13911397                                1A0F29CC120B37160053D1B9 /* VisitedLinkTable.h in Headers */,
     1398                                1A0F29E4120B44420053D1B9 /* VisitedLinkProvider.h in Headers */,
    13921399                        );
    13931400                        runOnlyForDeploymentPostprocessing = 0;
     
    15991606                                1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */,
    16001607                                1A0F29CB120B37160053D1B9 /* VisitedLinkTable.cpp in Sources */,
     1608                                1A0F29E3120B44420053D1B9 /* VisitedLinkProvider.cpp in Sources */,
    16011609                        );
    16021610                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit2/WebProcess/WebProcess.cpp

    r64594 r64775  
    178178    if (messageID.is<CoreIPC::MessageClassWebProcess>()) {
    179179        switch (messageID.get<WebProcessMessage::Kind>()) {
     180            case WebProcessMessage::SetVisitedLinkTable:
     181            case WebProcessMessage::VisitedLinkStateChanged:
     182            case WebProcessMessage::AllVisitedLinkStateChanged:
     183                // FIXME: Implement.
     184                return;
     185           
    180186            case WebProcessMessage::AddVisitedLink: {
    181187                WebCore::LinkHash hash;
  • trunk/WebKit2/win/WebKit2.vcproj

    r64768 r64775  
    954954                        </File>
    955955                        <File
     956                                RelativePath="..\UIProcess\VisitedLinkProvider.cpp"
     957                                >
     958                        </File>
     959                        <File
     960                                RelativePath="..\UIProcess\VisitedLinkProvider.h"
     961                                >
     962                        </File>
     963                        <File
    956964                                RelativePath="..\UIProcess\WebBackForwardList.cpp"
    957965                                >
Note: See TracChangeset for help on using the changeset viewer.