Changeset 80263 in webkit


Ignore:
Timestamp:
Mar 3, 2011 11:16:18 AM (13 years ago)
Author:
bweinstein@apple.com
Message:

Source/WebCore: Rest of WebKit2: Need a way to send notifications to client when cookies change
https://bugs.webkit.org/show_bug.cgi?id=55427
<rdar://problem/9056027>

Reviewed by Adam Roben.

Add functions to be exported.

  • WebCore.exp.in:

Source/WebKit2: Rest of WebKit2: Need a way to send notifications to client when cookies change
https://bugs.webkit.org/show_bug.cgi?id=55427
<rdar://problem/9056027>

Reviewed by Adam Roben.

This patch adds the communication from the WebProcess <-> UIProcess about starting/stopping
listening for cookies changing, and adds a mechanism for the WebProcess to notify the UIProcess
when the cookies have changed. The WebProcess sends a message to the UIProcess when the cookies
change, and the UIProcess passes this along to the WebCookieManagerProxyClient.

  • UIProcess/API/C/WKCookieManager.cpp:

(WKCookieManagerSetClient): Call through to WebCookieManagerProxy.
(WKCookieManagerStartObservingCookieChanges): Ditto.
(WKCookieManagerStopObservingCookieChanges): Ditto.

  • UIProcess/API/C/WKCookieManager.h: Add new functions and a WKCookieManagerClient

which is responsible for cookiesDidChange.

  • UIProcess/WebCookieManagerProxy.cpp:

(WebKit::WebCookieManagerProxy::initializeClient):
(WebKit::WebCookieManagerProxy::startObservingCookieChanges): Send the message down to the web process.
(WebKit::WebCookieManagerProxy::stopObservingCookieChanges): Ditto.
(WebKit::WebCookieManagerProxy::cookiesDidChange): Tell the WKCookieManagerClient the cookies were

modified.

  • UIProcess/WebCookieManagerProxy.h:
  • UIProcess/WebCookieManagerProxy.messages.in: Add new messages.
  • UIProcess/WebCookieManagerProxyClient.cpp: Added.

(WebKit::WebCookieManagerProxyClient::cookiesDidChange): Calls through to the client saying that

cookies changed.

  • UIProcess/WebCookieManagerProxyClient.h: Added.


  • WebProcess/Cookies/WebCookieManager.cpp:

(WebKit::WebCookieManager::startObservingCookieChanges): Call through to WebCore::startObservingCookieChanges

(on platforms that support it).

(WebKit::WebCookieManager::stopObservingCookieChanges): Ditto (for stopObservingCookieChanges).
(WebKit::WebCookieManager::dispatchDidModifyCookies): Send a message to the UI process that cookies changed.

  • WebProcess/Cookies/WebCookieManager.h:
  • WebProcess/Cookies/WebCookieManager.messages.in:


Add new files.

  • WebKit2.pro:
  • WebKit2.xcodeproj/project.pbxproj:
  • GNUmakefile.am:
  • win/WebKit2.vcproj:
Location:
trunk/Source
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r80260 r80263  
     12011-03-02  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Rest of WebKit2: Need a way to send notifications to client when cookies change
     6        https://bugs.webkit.org/show_bug.cgi?id=55427
     7        <rdar://problem/9056027>
     8
     9        Add functions to be exported.
     10
     11        * WebCore.exp.in:
     12
    1132011-03-03  Anders Carlsson  <andersca@apple.com>
    214
  • trunk/Source/WebCore/WebCore.exp.in

    r80200 r80263  
    579579__ZN7WebCore26contextMenuItemTagFontMenuEv
    580580__ZN7WebCore26contextMenuItemTagOpenLinkEv
     581__ZN7WebCore26stopObservingCookieChangesEv
    581582__ZN7WebCore26usesTestModeFocusRingColorEv
    582583__ZN7WebCore27AuthenticationChallengeBaseC2Ev
     
    588589__ZN7WebCore27contextMenuItemTagShowFontsEv
    589590__ZN7WebCore27contextMenuItemTagUnderlineEv
     591__ZN7WebCore27startObservingCookieChangesEv
    590592__ZN7WebCore28contextMenuItemTagCapitalizeEv
    591593__ZN7WebCore28contextMenuItemTagShowColorsEv
  • trunk/Source/WebKit2/ChangeLog

    r80261 r80263  
     12011-03-02  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Rest of WebKit2: Need a way to send notifications to client when cookies change
     6        https://bugs.webkit.org/show_bug.cgi?id=55427
     7        <rdar://problem/9056027>
     8       
     9        This patch adds the communication from the WebProcess <-> UIProcess about starting/stopping
     10        listening for cookies changing, and adds a mechanism for the WebProcess to notify the UIProcess
     11        when the cookies have changed. The WebProcess sends a message to the UIProcess when the cookies
     12        change, and the UIProcess passes this along to the WebCookieManagerProxyClient.
     13
     14        * UIProcess/API/C/WKCookieManager.cpp:
     15        (WKCookieManagerSetClient): Call through to WebCookieManagerProxy.
     16        (WKCookieManagerStartObservingCookieChanges): Ditto.
     17        (WKCookieManagerStopObservingCookieChanges): Ditto.
     18
     19        * UIProcess/API/C/WKCookieManager.h: Add new functions and a WKCookieManagerClient
     20            which is responsible for cookiesDidChange.
     21
     22        * UIProcess/WebCookieManagerProxy.cpp:
     23        (WebKit::WebCookieManagerProxy::initializeClient):
     24        (WebKit::WebCookieManagerProxy::startObservingCookieChanges): Send the message down to the web process.
     25        (WebKit::WebCookieManagerProxy::stopObservingCookieChanges): Ditto.
     26        (WebKit::WebCookieManagerProxy::cookiesDidChange): Tell the WKCookieManagerClient the cookies were
     27            modified.
     28        * UIProcess/WebCookieManagerProxy.h:
     29        * UIProcess/WebCookieManagerProxy.messages.in: Add new messages.
     30
     31        * UIProcess/WebCookieManagerProxyClient.cpp: Added.
     32        (WebKit::WebCookieManagerProxyClient::cookiesDidChange): Calls through to the client saying that
     33            cookies changed.
     34        * UIProcess/WebCookieManagerProxyClient.h: Added.
     35   
     36        * WebProcess/Cookies/WebCookieManager.cpp:
     37        (WebKit::WebCookieManager::startObservingCookieChanges): Call through to WebCore::startObservingCookieChanges
     38            (on platforms that support it).
     39        (WebKit::WebCookieManager::stopObservingCookieChanges): Ditto (for stopObservingCookieChanges).
     40        (WebKit::WebCookieManager::dispatchDidModifyCookies): Send a message to the UI process that cookies changed.
     41        * WebProcess/Cookies/WebCookieManager.h:
     42        * WebProcess/Cookies/WebCookieManager.messages.in:
     43       
     44        Add new files.
     45        * WebKit2.pro:
     46        * WebKit2.xcodeproj/project.pbxproj:
     47        * GNUmakefile.am:
     48        * win/WebKit2.vcproj:
     49
    1502011-03-03  Anders Carlsson  <andersca@apple.com>
    251
  • trunk/Source/WebKit2/GNUmakefile.am

    r79711 r80263  
    417417        Source/WebKit2/UIProcess/WebCookieManagerProxy.h \
    418418        Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp \
     419        Source/WebKit2/UIProcess/WebCookieManagerProxyClient.cpp \
     420        Source/WebKit2/UIProcess/WebCookieManagerProxyClient.h \
    419421        Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp \
    420422        Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.h \
  • trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp

    r79585 r80263  
    3737}
    3838
     39void WKCookieManagerSetClient(WKCookieManagerRef cookieManagerRef, const WKCookieManagerClient* wkClient)
     40{
     41    if (wkClient && wkClient->version)
     42        return;
     43    toImpl(cookieManagerRef)->initializeClient(wkClient);
     44}
     45
    3946void WKCookieManagerGetHostnamesWithCookies(WKCookieManagerRef cookieManagerRef, void* context, WKCookieManagerGetCookieHostnamesFunction callback)
    4047{
     
    5158    toImpl(cookieManagerRef)->deleteAllCookies();
    5259}
     60
     61void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager)
     62{
     63    toImpl(cookieManager)->startObservingCookieChanges();
     64}
     65
     66void WKCookieManagerStopObservingCookieChanges(WKCookieManagerRef cookieManager)
     67{
     68    toImpl(cookieManager)->stopObservingCookieChanges();
     69}
  • trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.h

    r79585 r80263  
    3333#endif
    3434
     35// Cookie Manager Client
     36typedef void (*WKCookieManagerCookiesDidChangeCallback)(WKCookieManagerRef cookieManager, const void *clientInfo);
     37
     38struct WKCookieManagerClient {
     39    int                                                                 version;
     40    const void *                                                        clientInfo;
     41    WKCookieManagerCookiesDidChangeCallback                             cookiesDidChange;
     42};
     43typedef struct WKCookieManagerClient WKCookieManagerClient;
     44
    3545WK_EXPORT WKTypeID WKCookieManagerGetTypeID();
     46
     47WK_EXPORT void WKCookieManagerSetClient(WKCookieManagerRef cookieManager, const WKCookieManagerClient* client);
    3648
    3749typedef void (*WKCookieManagerGetCookieHostnamesFunction)(WKArrayRef, WKErrorRef, void*);
     
    4153WK_EXPORT void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManager);
    4254
     55WK_EXPORT void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager);
     56WK_EXPORT void WKCookieManagerStopObservingCookieChanges(WKCookieManagerRef cookieManager);
     57
    4358#ifdef __cplusplus
    4459}
  • trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp

    r79585 r80263  
    5151{
    5252    invalidateCallbackMap(m_arrayCallbacks);
     53}
     54
     55void WebCookieManagerProxy::initializeClient(const WKCookieManagerClient* client)
     56{
     57    m_client.initialize(client);
    5358}
    5459
     
    106111}
    107112
     113void WebCookieManagerProxy::startObservingCookieChanges()
     114{
     115    ASSERT(m_webContext);
     116    if (!m_webContext->hasValidProcess())
     117        return;
     118    m_webContext->process()->send(Messages::WebCookieManager::StartObservingCookieChanges(), 0);
     119}
     120
     121void WebCookieManagerProxy::stopObservingCookieChanges()
     122{
     123    ASSERT(m_webContext);
     124    if (!m_webContext->hasValidProcess())
     125        return;
     126    m_webContext->process()->send(Messages::WebCookieManager::StopObservingCookieChanges(), 0);
     127}
     128
     129void WebCookieManagerProxy::cookiesDidChange()
     130{
     131    m_client.cookiesDidChange(this);
     132}
     133
    108134} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h

    r79585 r80263  
    3030#include "GenericCallback.h"
    3131#include "ImmutableArray.h"
     32#include "WebCookieManagerProxyClient.h"
    3233#include <wtf/PassRefPtr.h>
    3334#include <wtf/RefPtr.h>
     
    5556    void invalidate();
    5657    void clearContext() { m_webContext = 0; }
     58
     59    void initializeClient(const WKCookieManagerClient*);
    5760   
    5861    void getHostnamesWithCookies(PassRefPtr<ArrayCallback>);
    5962    void deleteCookiesForHostname(const String& hostname);
    6063    void deleteAllCookies();
     64
     65    void startObservingCookieChanges();
     66    void stopObservingCookieChanges();
    6167
    6268    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     
    6874
    6975    void didGetHostnamesWithCookies(const Vector<String>&, uint64_t callbackID);
     76
     77    void cookiesDidChange();
    7078   
    7179    void didReceiveWebCookieManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     
    7381    WebContext* m_webContext;
    7482    HashMap<uint64_t, RefPtr<ArrayCallback> > m_arrayCallbacks;
     83
     84    WebCookieManagerProxyClient m_client;
    7585};
    7686
  • trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in

    r79585 r80263  
    2323messages -> WebCookieManagerProxy {
    2424    DidGetHostnamesWithCookies(Vector<WTF::String> hostnames, uint64_t callbackID);
     25   
     26    CookiesDidChange()
    2527}
  • trunk/Source/WebKit2/WebKit2.pro

    r79999 r80263  
    169169    UIProcess/WebContextUserMessageCoders.h \
    170170    UIProcess/WebCookieManagerProxy.h \
     171    UIProcess/WebCookieManagerProxyClient.h \
    171172    UIProcess/WebDatabaseManagerProxy.h \
    172173    UIProcess/WebDatabaseManagerProxyClient.h \
     
    346347    UIProcess/WebContextMenuProxy.cpp \
    347348    UIProcess/WebCookieManagerProxy.cpp \
     349    UIProcess/WebCookieManagerProxyClient.cpp \
    348350    UIProcess/WebDatabaseManagerProxy.cpp \
    349351    UIProcess/WebDatabaseManagerProxyClient.cpp \
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r80080 r80263  
    262262                33367657130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33367653130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessageReceiver.cpp */; };
    263263                33367658130C9ECB006C9DE2 /* WebResourceCacheManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 33367654130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessages.h */; };
     264                33AA1066131F060000D4A575 /* WebCookieManagerProxyClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33AA1064131F060000D4A575 /* WebCookieManagerProxyClient.cpp */; };
     265                33AA1067131F060000D4A575 /* WebCookieManagerProxyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 33AA1065131F060000D4A575 /* WebCookieManagerProxyClient.h */; };
    264266                33F9D5B91312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33F9D5B81312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp */; };
    265267                37C4E9F6131C6E7E0029BD5A /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = B396EA5512E0ED2D00F4FEB7 /* config.h */; };
     
    10811083                33367653130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceCacheManagerProxyMessageReceiver.cpp; sourceTree = "<group>"; };
    10821084                33367654130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceCacheManagerProxyMessages.h; sourceTree = "<group>"; };
     1085                33AA1064131F060000D4A575 /* WebCookieManagerProxyClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCookieManagerProxyClient.cpp; sourceTree = "<group>"; };
     1086                33AA1065131F060000D4A575 /* WebCookieManagerProxyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCookieManagerProxyClient.h; sourceTree = "<group>"; };
    10831087                33F9D5B81312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = WebResourceCacheManagerCFNet.cpp; path = ResourceCache/cf/WebResourceCacheManagerCFNet.cpp; sourceTree = "<group>"; };
    10841088                37F623B712A57B6200E3FDF6 /* WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindOptions.h; sourceTree = "<group>"; };
     
    23522356                                330934531315B9750097A7BC /* WebCookieManagerProxy.h */,
    23532357                                330934541315B9750097A7BC /* WebCookieManagerProxy.messages.in */,
     2358                                33AA1064131F060000D4A575 /* WebCookieManagerProxyClient.cpp */,
     2359                                33AA1065131F060000D4A575 /* WebCookieManagerProxyClient.h */,
    23542360                                F62A765912B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp */,
    23552361                                F62A765A12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h */,
     
    33843390                                BCE81D99131AE02100241910 /* DictionaryPopupInfo.h in Headers */,
    33853391                                37C4E9F6131C6E7E0029BD5A /* config.h in Headers */,
     3392                                33AA1067131F060000D4A575 /* WebCookieManagerProxyClient.h in Headers */,
    33863393                        );
    33873394                        runOnlyForDeploymentPostprocessing = 0;
     
    39613968                                BCE81D8C1319F7EF00241910 /* FontInfo.cpp in Sources */,
    39623969                                BCE81D98131AE02100241910 /* DictionaryPopupInfo.cpp in Sources */,
     3970                                33AA1066131F060000D4A575 /* WebCookieManagerProxyClient.cpp in Sources */,
    39633971                        );
    39643972                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp

    r80145 r80263  
    7575}
    7676
    77 void WebCookieManager::dispatchDidModifyCookies()
     77void WebCookieManager::startObservingCookieChanges()
    7878{
    79     // FIXME <http://webkit.org/b/55427>: Send a message to the UIProcess that the cookies have changed.
     79#if USE(CFNETWORK) || PLATFORM(MAC)
     80    WebCore::startObservingCookieChanges();
     81#endif
     82}
     83
     84void WebCookieManager::stopObservingCookieChanges()
     85{
     86#if USE(CFNETWORK) || PLATFORM(MAC)
     87    WebCore::stopObservingCookieChanges();
     88#endif
     89}
     90
     91void WebCookieManager::dispatchCookiesDidChange()
     92{
     93    WebProcess::shared().connection()->send(Messages::WebCookieManagerProxy::CookiesDidChange(), 0);
    8094}
    8195
  • trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h

    r80145 r80263  
    4545    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
    4646   
    47     void dispatchDidModifyCookies();
     47    void dispatchCookiesDidChange();
    4848
    4949private:
     
    5454    void deleteAllCookies();
    5555
     56    void startObservingCookieChanges();
     57    void stopObservingCookieChanges();
     58
    5659    void didReceiveWebCookieManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
    5760};
  • trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in

    r79585 r80263  
    2828    void DeleteCookiesForHostname(WTF::String hostname)
    2929    void DeleteAllCookies()
     30   
     31    void StartObservingCookieChanges()
     32    void StopObservingCookieChanges()
    3033}
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp

    r80145 r80263  
    124124void WebPlatformStrategies::notifyCookiesChanged()
    125125{
    126     WebCookieManager::shared().dispatchDidModifyCookies();
     126    WebCookieManager::shared().dispatchCookiesDidChange();
    127127}
    128128
  • trunk/Source/WebKit2/win/WebKit2.vcproj

    r80240 r80263  
    24202420                        </File>
    24212421                        <File
     2422                                RelativePath="..\UIProcess\WebCookieManagerProxyClient.cpp"
     2423                                >
     2424                        </File>
     2425                        <File
     2426                                RelativePath="..\UIProcess\WebCookieManagerProxyClient.h"
     2427                                >
     2428                        </File>
     2429                        <File
    24222430                                RelativePath="..\UIProcess\WebDatabaseManagerProxy.cpp"
    24232431                                >
Note: See TracChangeset for help on using the changeset viewer.