Changeset 64797 in webkit


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

Use the visited link provider for visited links
https://bugs.webkit.org/show_bug.cgi?id=43583

Reviewed by Sam Weinig.

WebCore:

Export Page::visitedStateChanged and Page::allvisitedStateChanged.

  • WebCore.exp.in:

WebKit2:

  • Shared/CoreIPCSupport/WebProcessMessageKinds.h:

(WebProcessMessage::):
Remove AddVisitedLink.

  • Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h:

(WebProcessProxyMessage::):
Remove PopulateVisitedLinks and add AddVisitedLink.

  • UIProcess/WebContext.cpp:

(WebKit::WebContext::sharedProcessContext):
Initialize the main run loop before creating the context.

(WebKit::WebContext::sharedThreadContext):
Ditto.

(WebKit::WebContext::create):
Ditto.

(WebKit::WebContext::WebContext):
Initialize the visited link provider.

(WebKit::WebContext::processDidFinishLaunching):
Ask the visited link provider to populate visited links.

(WebKit::WebContext::addVisitedLink):
Ask the visited link provider to add the visited link.

  • UIProcess/WebProcessProxy.cpp:

(WebKit::WebProcessProxy::addVisitedLink):
Call WebContext::addVisitedLink.

(WebKit::WebProcessProxy::didReceiveMessage):
Handle AddVisitedLink.

(WebKit::WebProcessProxy::didFinishLaunching):
Call WebContext::processdidFinishLaunching.

  • UIProcess/WebProcessProxy.h:
  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::populateVisitedLinks):
Don't send the WebProcessProxyMessage::PopulateVisitedLinks message.

  • WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:

(WebKit::WebPlatformStrategies::isLinkVisited):
Call WebProcess::isLinkVisited.

(WebKit::WebPlatformStrategies::addVisitedLink):
Call WebProcess::addVisitedLink.

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::setVisitedLinkTable):
Create a shared memory object and tell the visited link table about it.

(WebKit::WebProcess::visitedLinkStateChanged):
Go through the link hashes and call Page::visitedStateChanged.

(WebKit::WebProcess::allVisitedLinkStateChanged):
Call Page::allVisitedStateChanged.

(WebKit::WebProcess::isLinkVisited):
Call VisitedLinkTable::isLinkVisited.

(WebKit::WebProcess::addVisitedLink):
Inform the UI process about the added link.

(WebKit::WebProcess::didReceiveMessage):
Handle new messages.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r64793 r64797  
     12010-08-05  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Use the visited link provider for visited links
     6        https://bugs.webkit.org/show_bug.cgi?id=43583
     7
     8        Export Page::visitedStateChanged and Page::allvisitedStateChanged.
     9
     10        * WebCore.exp.in:
     11
    1122010-08-05  Eric Seidel  <eric@webkit.org>
    213
  • trunk/WebCore/WebCore.exp.in

    r64518 r64797  
    559559__ZN7WebCore4Page17willMoveOffscreenEv
    560560__ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS_12SchedulePairEEE
     561__ZN7WebCore4Page19visitedStateChangedEPNS_9PageGroupEy
     562__ZN7WebCore4Page22allVisitedStateChangedEPNS_9PageGroupE
    561563__ZN7WebCore4Page23clearUndoRedoOperationsEv
    562564__ZN7WebCore4Page27setJavaScriptURLsAreAllowedEb
  • trunk/WebKit2/ChangeLog

    r64795 r64797  
     12010-08-05  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Use the visited link provider for visited links
     6        https://bugs.webkit.org/show_bug.cgi?id=43583
     7
     8        * Shared/CoreIPCSupport/WebProcessMessageKinds.h:
     9        (WebProcessMessage::):
     10        Remove AddVisitedLink.
     11
     12        * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h:
     13        (WebProcessProxyMessage::):
     14        Remove PopulateVisitedLinks and add AddVisitedLink.
     15
     16        * UIProcess/WebContext.cpp:
     17        (WebKit::WebContext::sharedProcessContext):
     18        Initialize the main run loop before creating the context.
     19       
     20        (WebKit::WebContext::sharedThreadContext):
     21        Ditto.
     22       
     23        (WebKit::WebContext::create):
     24        Ditto.
     25
     26        (WebKit::WebContext::WebContext):
     27        Initialize the visited link provider.
     28
     29        (WebKit::WebContext::processDidFinishLaunching):
     30        Ask the visited link provider to populate visited links.
     31
     32        (WebKit::WebContext::addVisitedLink):
     33        Ask the visited link provider to add the visited link.
     34
     35        * UIProcess/WebProcessProxy.cpp:
     36        (WebKit::WebProcessProxy::addVisitedLink):
     37        Call WebContext::addVisitedLink.
     38
     39        (WebKit::WebProcessProxy::didReceiveMessage):
     40        Handle AddVisitedLink.
     41
     42        (WebKit::WebProcessProxy::didFinishLaunching):
     43        Call WebContext::processdidFinishLaunching.
     44
     45        * UIProcess/WebProcessProxy.h:
     46        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     47        (WebKit::WebChromeClient::populateVisitedLinks):
     48        Don't send the WebProcessProxyMessage::PopulateVisitedLinks message.
     49
     50        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
     51        (WebKit::WebPlatformStrategies::isLinkVisited):
     52        Call WebProcess::isLinkVisited.
     53       
     54        (WebKit::WebPlatformStrategies::addVisitedLink):
     55        Call WebProcess::addVisitedLink.
     56
     57        * WebProcess/WebProcess.cpp:
     58        (WebKit::WebProcess::setVisitedLinkTable):
     59        Create a shared memory object and tell the visited link table about it.
     60
     61        (WebKit::WebProcess::visitedLinkStateChanged):
     62        Go through the link hashes and call Page::visitedStateChanged.
     63
     64        (WebKit::WebProcess::allVisitedLinkStateChanged):
     65        Call Page::allVisitedStateChanged.
     66
     67        (WebKit::WebProcess::isLinkVisited):
     68        Call VisitedLinkTable::isLinkVisited.
     69
     70        (WebKit::WebProcess::addVisitedLink):
     71        Inform the UI process about the added link.
     72
     73        (WebKit::WebProcess::didReceiveMessage):
     74        Handle new messages.
     75
    1762010-08-05  Steve Falkenburg  <sfalken@apple.com>
    277
  • trunk/WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h

    r64775 r64797  
    3838    AllVisitedLinkStateChanged,
    3939   
    40     // FIXME: Remove AddVisitedLink.
    41     AddVisitedLink,
    4240    LoadInjectedBundle,
    4341    SetApplicationCacheDirectory,
  • trunk/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h

    r64396 r64797  
    3535enum Kind {
    3636    AddBackForwardItem,
     37    AddVisitedLink,
    3738    DidNavigateWithNavigationData,
    3839    DidPerformClientRedirect,
     
    4041    DidUpdateHistoryTitle,
    4142    GetPluginHostConnection,
    42     GetPlugins,
    43     PopulateVisitedLinks,
     43    GetPlugins
    4444};
    4545
  • trunk/WebKit2/UIProcess/WebContext.cpp

    r64492 r64797  
    175175WebContext* WebContext::sharedProcessContext()
    176176{
     177    RunLoop::initializeMainRunLoop();
    177178    static WebContext* context = adoptRef(new WebContext(ProcessModelSharedSecondaryProcess, String())).leakRef();
    178179    return context;
     
    181182WebContext* WebContext::sharedThreadContext()
    182183{
     184    RunLoop::initializeMainRunLoop();
    183185    static WebContext* context = adoptRef(new WebContext(ProcessModelSharedSecondaryThread, String())).leakRef();
    184186    return context;
    185187}
    186188
     189PassRefPtr<WebContext> WebContext::create(const String& injectedBundlePath)
     190{
     191    RunLoop::initializeMainRunLoop();
     192    return adoptRef(new WebContext(ProcessModelSecondaryProcess, injectedBundlePath));
     193}
     194   
    187195WebContext::WebContext(ProcessModel processModel, const WebCore::String& injectedBundlePath)
    188196    : m_processModel(processModel)
    189197    , m_injectedBundlePath(injectedBundlePath)
     198    , m_visitedLinkProvider(this)
    190199{
    191200    RunLoop::initializeMainRunLoop();
     
    237246}
    238247
     248void WebContext::processDidFinishLaunching(WebProcessProxy* process)
     249{
     250    // FIXME: Once we support multiple processes per context, this assertion won't hold.
     251    ASSERT(process == m_process);
     252
     253    m_visitedLinkProvider.populateVisitedLinksIfNeeded();
     254}
     255
    239256WebPageProxy* WebContext::createWebPage(WebPageNamespace* pageNamespace)
    240257{
     
    372389        return;
    373390
    374     WebCore::LinkHash hash = visitedLinkHash(visitedURL.characters(), visitedURL.length());
    375     m_process->send(WebProcessMessage::AddVisitedLink, 0, CoreIPC::In(hash));
    376 }
    377 
     391    LinkHash linkHash = visitedLinkHash(visitedURL.characters(), visitedURL.length());
     392    addVisitedLink(linkHash);
     393}
     394
     395void WebContext::addVisitedLink(LinkHash linkHash)
     396{
     397    m_visitedLinkProvider.addVisitedLink(linkHash);
     398}
     399       
    378400void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder& arguments)
    379401{
  • trunk/WebKit2/UIProcess/WebContext.h

    r64492 r64797  
    3030#include "PluginInfoStore.h"
    3131#include "ProcessModel.h"
     32#include "VisitedLinkProvider.h"
    3233#include "WebContextInjectedBundleClient.h"
    3334#include "WebHistoryClient.h"
    3435#include "WebProcessProxy.h"
     36#include <WebCore/LinkHash.h>
    3537#include <WebCore/PlatformString.h>
    3638#include <WebCore/StringHash.h>
     
    5557    static WebContext* sharedThreadContext();
    5658
    57     static PassRefPtr<WebContext> create(const WebCore::String& injectedBundlePath)
    58     {
    59         return adoptRef(new WebContext(ProcessModelSecondaryProcess, injectedBundlePath));
    60     }
     59    static PassRefPtr<WebContext> create(const WebCore::String& injectedBundlePath);
    6160
    6261    ~WebContext();
     
    6766    ProcessModel processModel() const { return m_processModel; }
    6867    WebProcessProxy* process() const { return m_process.get(); }
     68
     69    void processDidFinishLaunching(WebProcessProxy*);
    6970
    7071    WebPageProxy* createWebPage(WebPageNamespace*);
     
    102103   
    103104    void addVisitedLink(const WebCore::String&);
     105    void addVisitedLink(WebCore::LinkHash);
    104106
    105107    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder&);
     
    127129
    128130    PluginInfoStore m_pluginInfoStore;
    129    
     131    VisitedLinkProvider m_visitedLinkProvider;
     132       
    130133    HashSet<WebCore::String> m_schemesToRegisterAsEmptyDocument;
    131134};
  • trunk/WebKit2/UIProcess/WebProcessProxy.cpp

    r64744 r64797  
    217217}
    218218
     219void WebProcessProxy::addVisitedLink(LinkHash linkHash)
     220{
     221    m_context->addVisitedLink(linkHash);
     222}
     223
    219224void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
    220225{
     
    232237            }
    233238
     239            case WebProcessProxyMessage::AddVisitedLink: {
     240                LinkHash linkHash;
     241
     242                if (!arguments->decode(CoreIPC::Out(linkHash)))
     243                    return;
     244
     245                addVisitedLink(linkHash);
     246                return;
     247            }
     248
    234249            case WebProcessProxyMessage::DidNavigateWithNavigationData: {
    235250                uint64_t pageID;
     
    291306                break;
    292307            }
    293             case WebProcessProxyMessage::PopulateVisitedLinks: {
    294                 m_context->populateVisitedLinks();
    295                 break;
    296             }
    297308
    298309            // These are synchronous messages and should never be handled here.
     
    355366            case WebProcessProxyMessage::DidPerformServerRedirect:
    356367            case WebProcessProxyMessage::DidUpdateHistoryTitle:
    357             case WebProcessProxyMessage::PopulateVisitedLinks:
    358368            case WebProcessProxyMessage::AddBackForwardItem:
     369            case WebProcessProxyMessage::AddVisitedLink:
    359370                ASSERT_NOT_REACHED();
    360371                break;
     
    416427    }
    417428
    418     m_pendingMessages.clear();   
     429    m_pendingMessages.clear();
     430
     431    // Tell the context that we finished launching.
     432    m_context->processDidFinishLaunching(this);
    419433}
    420434
  • trunk/WebKit2/UIProcess/WebProcessProxy.h

    r64396 r64797  
    3434#include "ResponsivenessTimer.h"
    3535#include "WebPageProxy.h"
     36#include <WebCore/LinkHash.h>
    3637#include <wtf/HashMap.h>
    3738#include <wtf/PassRefPtr.h>
     
    101102
    102103    void addOrUpdateBackForwardListItem(uint64_t itemID, const WebCore::String& originalURLString, const WebCore::String& urlString, const WebCore::String& title);
     104    void addVisitedLink(WebCore::LinkHash);
    103105
    104106    // CoreIPC::Connection::Client
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r64594 r64797  
    411411void WebChromeClient::populateVisitedLinks()
    412412{
    413     WebProcess::shared().connection()->send(WebProcessProxyMessage::PopulateVisitedLinks, 0, CoreIPC::In());
    414413}
    415414
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp

    r64563 r64797  
    813813
    814814// VisitedLinkStrategy
    815 bool WebPlatformStrategies::isLinkVisited(Page* page, LinkHash hash)
    816 {
    817     // FIXME: Have WebKit2 manage its own visited links
    818     return page->group().isLinkVisited(hash);
    819 }
    820 
    821 void WebPlatformStrategies::addVisitedLink(Page* page, LinkHash hash)
    822 {
    823     // FIXME: Have WebKit2 manage its own visited links
    824     return page->group().addVisitedLinkHash(hash);
     815bool WebPlatformStrategies::isLinkVisited(Page* page, LinkHash linkHash)
     816{
     817    return WebProcess::shared().isLinkVisited(linkHash);
     818}
     819
     820void WebPlatformStrategies::addVisitedLink(Page* page, LinkHash linkHash)
     821{
     822    WebProcess::shared().addVisitedLink(linkHash);
    825823}
    826824
  • trunk/WebKit2/WebProcess/WebProcess.cpp

    r64775 r64797  
    3434#include "WebPlatformStrategies.h"
    3535#include "WebPreferencesStore.h"
     36#include "WebProcessProxyMessageKinds.h"
    3637#include "WebProcessMessageKinds.h"
    3738#include <WebCore/ApplicationCacheStorage.h>
     39#include <WebCore/Page.h>
    3840#include <WebCore/PageGroup.h>
    3941#include <WebCore/SchemeRegistry.h>
     
    111113}
    112114
    113 void WebProcess::addVisitedLinkHash(WebCore::LinkHash hash)
    114 {
    115     PageGroup* group = PageGroup::pageGroup("WebKit2Group");
    116     ASSERT(group);
    117     if (!group) {
    118         printf("Cannot find PageGroup named 'WebKit2Group'\n");
    119         return;
    120     }
    121     group->addVisitedLinkHash(hash);
     115void WebProcess::setVisitedLinkTable(const SharedMemory::Handle& handle)
     116{
     117    RefPtr<SharedMemory> sharedMemory = SharedMemory::create(handle, SharedMemory::ReadOnly);
     118    if (!sharedMemory)
     119        return;
     120
     121    m_visitedLinkTable.setSharedMemory(sharedMemory.release());
     122}
     123
     124static PageGroup* webKit2PageGroup()
     125{
     126    return PageGroup::pageGroup("WebKit2Group");
     127}
     128
     129void WebProcess::visitedLinkStateChanged(const Vector<WebCore::LinkHash>& linkHashes)
     130{
     131    for (size_t i = 0; i < linkHashes.size(); ++i)
     132        Page::visitedStateChanged(webKit2PageGroup(), linkHashes[i]);
     133}
     134
     135void WebProcess::allVisitedLinkStateChanged()
     136{
     137    Page::allVisitedStateChanged(webKit2PageGroup());
     138}
     139
     140bool WebProcess::isLinkVisited(LinkHash linkHash) const
     141{
     142    return m_visitedLinkTable.isLinkVisited(linkHash);
     143}
     144
     145void WebProcess::addVisitedLink(WebCore::LinkHash linkHash)
     146{
     147    if (isLinkVisited(linkHash))
     148        return;
     149
     150    m_connection->send(WebProcessProxyMessage::AddVisitedLink, 0, CoreIPC::In(linkHash));
    122151}
    123152
     
    178207    if (messageID.is<CoreIPC::MessageClassWebProcess>()) {
    179208        switch (messageID.get<WebProcessMessage::Kind>()) {
    180             case WebProcessMessage::SetVisitedLinkTable:
    181             case WebProcessMessage::VisitedLinkStateChanged:
     209            case WebProcessMessage::SetVisitedLinkTable: {
     210                SharedMemory::Handle handle;
     211                if (!arguments->decode(CoreIPC::Out(handle)))
     212                    return;
     213               
     214                setVisitedLinkTable(handle);
     215                return;
     216            }
     217            case WebProcessMessage::VisitedLinkStateChanged: {
     218                Vector<LinkHash> linkHashes;
     219                if (!arguments->decode(CoreIPC::Out(linkHashes)))
     220                    return;
     221                visitedLinkStateChanged(linkHashes);
     222            }
    182223            case WebProcessMessage::AllVisitedLinkStateChanged:
    183                 // FIXME: Implement.
     224                allVisitedLinkStateChanged();
    184225                return;
    185226           
    186             case WebProcessMessage::AddVisitedLink: {
    187                 WebCore::LinkHash hash;
    188                 if (!arguments->decode(CoreIPC::Out(hash)))
    189                     return;
    190 
    191                 addVisitedLinkHash(hash);
    192                 return;
    193             }
    194227            case WebProcessMessage::LoadInjectedBundle: {
    195228                String path;
  • trunk/WebKit2/WebProcess/WebProcess.h

    r64594 r64797  
    2929#include "Connection.h"
    3030#include "DrawingArea.h"
     31#include "SharedMemory.h"
     32#include "VisitedLinkTable.h"
    3133#include <WebCore/LinkHash.h>
    3234#include <wtf/HashMap.h>
     
    6466#endif
    6567   
     68    void addVisitedLink(WebCore::LinkHash);
     69    bool isLinkVisited(WebCore::LinkHash) const;
     70
    6671private:
    6772    WebProcess();
     
    7580    void setApplicationCacheDirectory(const WebCore::String&);
    7681    void registerURLSchemeAsEmptyDocument(const WebCore::String&);
    77     void addVisitedLinkHash(WebCore::LinkHash);
    7882
     83    void setVisitedLinkTable(const SharedMemory::Handle&);
     84    void visitedLinkStateChanged(const Vector<WebCore::LinkHash>& linkHashes);
     85    void allVisitedLinkStateChanged();
     86   
    7987    // CoreIPC::Connection::Client
    8088    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     
    9098    RunLoop* m_runLoop;
    9199
     100    // FIXME: The visited link table should not be per process.
     101    VisitedLinkTable m_visitedLinkTable;
     102
    92103#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
    93104    mach_port_t m_compositingRenderServerPort;
Note: See TracChangeset for help on using the changeset viewer.