⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 181707 in webkit


Ignore:
Timestamp:
Mar 18, 2015, 12:54:40 PM (11 years ago)
Author:
andersca@apple.com
Message:

Add WKContextGetWebsiteDataStore API
https://bugs.webkit.org/show_bug.cgi?id=142832
rdar://problem/16544715

Reviewed by Sam Weinig.

Also add WKWebsiteDataStoreRef which is toll-free bridged to _WKWebsiteDataStore.

  • Shared/API/c/WKBase.h:

Add new declaration.

  • UIProcess/API/APIWebsiteDataStore.cpp:

(API::WebsiteDataStore::create):

  • UIProcess/API/APIWebsiteDataStore.h:

Add a new function that takes a configuration.

  • UIProcess/API/C/WKAPICast.h:

Add cast.

  • UIProcess/API/C/WKContext.cpp:

(WKContextGetWebsiteDataStore):
Return the context's website data store.

  • UIProcess/API/C/WKContext.h:

Add new declaration.

  • UIProcess/API/C/WKWebsiteDataStoreRef.cpp: Added.
  • UIProcess/API/C/WKWebsiteDataStoreRef.h: Added.

Add new files.

  • UIProcess/WebKeyValueStorageManager.cpp:

(WebKit::WebKeyValueStorageManager::getKeyValueStorageOrigins):
(WebKit::WebKeyValueStorageManager::getStorageDetailsByOrigin):
(WebKit::WebKeyValueStorageManager::deleteEntriesForOrigin):
(WebKit::WebKeyValueStorageManager::deleteAllEntries):
Update now that WebProcessPool holds on to an API::WebsiteDataStore.

  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::WebProcessPool):
(WebKit::WebProcessPool::createWebPage):

  • UIProcess/WebProcessPool.h:

WebProcessPool should hold on to an API::WebsiteDataStore instead of a WebKit::WebsiteDataStore.

  • WebKit2.xcodeproj/project.pbxproj:

Add new files.

Location:
trunk/Source/WebKit2
Files:
11 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r181705 r181707  
     12015-03-18  Anders Carlsson  <andersca@apple.com>
     2
     3        Add WKContextGetWebsiteDataStore API
     4        https://bugs.webkit.org/show_bug.cgi?id=142832
     5        rdar://problem/16544715
     6
     7        Reviewed by Sam Weinig.
     8
     9        Also add WKWebsiteDataStoreRef which is toll-free bridged to _WKWebsiteDataStore.
     10
     11        * Shared/API/c/WKBase.h:
     12        Add new declaration.
     13
     14        * UIProcess/API/APIWebsiteDataStore.cpp:
     15        (API::WebsiteDataStore::create):
     16        * UIProcess/API/APIWebsiteDataStore.h:
     17        Add a new function that takes a configuration.
     18
     19        * UIProcess/API/C/WKAPICast.h:
     20        Add cast.
     21
     22        * UIProcess/API/C/WKContext.cpp:
     23        (WKContextGetWebsiteDataStore):
     24        Return the context's website data store.
     25
     26        * UIProcess/API/C/WKContext.h:
     27        Add new declaration.
     28
     29        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: Added.
     30        * UIProcess/API/C/WKWebsiteDataStoreRef.h: Added.
     31        Add new files.
     32
     33        * UIProcess/WebKeyValueStorageManager.cpp:
     34        (WebKit::WebKeyValueStorageManager::getKeyValueStorageOrigins):
     35        (WebKit::WebKeyValueStorageManager::getStorageDetailsByOrigin):
     36        (WebKit::WebKeyValueStorageManager::deleteEntriesForOrigin):
     37        (WebKit::WebKeyValueStorageManager::deleteAllEntries):
     38        Update now that WebProcessPool holds on to an API::WebsiteDataStore.
     39
     40        * UIProcess/WebProcessPool.cpp:
     41        (WebKit::WebProcessPool::WebProcessPool):
     42        (WebKit::WebProcessPool::createWebPage):
     43        * UIProcess/WebProcessPool.h:
     44        WebProcessPool should hold on to an API::WebsiteDataStore instead of a WebKit::WebsiteDataStore.
     45
     46        * WebKit2.xcodeproj/project.pbxproj:
     47        Add new files.
     48
    1492015-03-18  Tim Horton  <timothy_horton@apple.com>
    250
  • trunk/Source/WebKit2/Shared/API/c/WKBase.h

    r181252 r181707  
    140140typedef const struct OpaqueWKVibration* WKVibrationRef;
    141141typedef const struct OpaqueWKViewportAttributes* WKViewportAttributesRef;
     142typedef const struct OpaqueWKWebsiteDataStore* WKWebsiteDataStoreRef;
    142143
    143144/* WebKit2 Bundle types */
  • trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp

    r179932 r181707  
    4343}
    4444
     45RefPtr<WebsiteDataStore> WebsiteDataStore::create(WebKit::WebsiteDataStore::Configuration configuration)
     46{
     47    return adoptRef(new WebsiteDataStore(WTF::move(configuration)));
     48}
     49
    4550WebsiteDataStore::WebsiteDataStore()
    4651    : m_websiteDataStore(WebKit::WebsiteDataStore::createNonPersistent())
  • trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h

    r178685 r181707  
    3838    static RefPtr<WebsiteDataStore> defaultDataStore();
    3939    static RefPtr<WebsiteDataStore> createNonPersistentDataStore();
     40    static RefPtr<WebsiteDataStore> create(WebKit::WebsiteDataStore::Configuration);
    4041    virtual ~WebsiteDataStore();
    4142
  • trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h

    r181562 r181707  
    6464class UserContentExtensionStore;
    6565class UserScript;
     66class WebsiteDataStore;
    6667}
    6768
     
    140141WK_ADD_API_MAPPING(WKHitTestResultRef, WebHitTestResult)
    141142WK_ADD_API_MAPPING(WKIconDatabaseRef, WebIconDatabase)
     143WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
    142144WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManager)
    143145WK_ADD_API_MAPPING(WKMediaCacheManagerRef, WebMediaCacheManagerProxy)
     
    170172WK_ADD_API_MAPPING(WKVibrationRef, WebVibrationProxy)
    171173WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes)
    172 WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
     174WK_ADD_API_MAPPING(WKWebsiteDataStoreRef, API::WebsiteDataStore)
    173175
    174176/* Enum conversions */
  • trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp

    r180277 r181707  
    415415}
    416416
     417WKWebsiteDataStoreRef WKContextGetWebsiteDataStore(WKContextRef context)
     418{
     419    return toAPI(&toImpl(context)->websiteDataStore());
     420}
     421
    417422WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef contextRef)
    418423{
  • trunk/Source/WebKit2/UIProcess/API/C/WKContext.h

    r180277 r181707  
    132132WK_EXPORT void WKContextStopMemorySampler(WKContextRef context);
    133133
     134WK_EXPORT WKWebsiteDataStoreRef WKContextGetWebsiteDataStore(WKContextRef context);
     135
    134136WK_EXPORT WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef context);
    135137WK_EXPORT WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef context);
  • trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp

    r181706 r181707  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef APIWebsiteDataStore_h
    27 #define APIWebsiteDataStore_h
     26#include "config.h"
     27#include "WKWebsiteDataStoreRef.h"
    2828
    29 #include "APIObject.h"
    30 #include "WebsiteDataStore.h"
    31 #include <WebCore/SessionID.h>
    32 #include <wtf/text/WTFString.h>
     29#include "APIWebsiteDataStore.h"
     30#include "WKAPICast.h"
    3331
    34 namespace API {
    35 
    36 class WebsiteDataStore final : public ObjectImpl<Object::Type::WebsiteDataStore> {
    37 public:
    38     static RefPtr<WebsiteDataStore> defaultDataStore();
    39     static RefPtr<WebsiteDataStore> createNonPersistentDataStore();
    40     virtual ~WebsiteDataStore();
    41 
    42     bool isNonPersistent();
    43 
    44     WebKit::WebsiteDataStore& websiteDataStore() { return *m_websiteDataStore; }
    45 
    46     static String websiteDataDirectoryFileSystemRepresentation(const String& directoryName);
    47 
    48 private:
    49     WebsiteDataStore(WebKit::WebsiteDataStore::Configuration);
    50     WebsiteDataStore();
    51 
    52     static WebKit::WebsiteDataStore::Configuration defaultDataStoreConfiguration();
    53 
    54     RefPtr<WebKit::WebsiteDataStore> m_websiteDataStore;
    55 };
    56 
     32WKTypeID WKWebsiteDataStoreGetTypeID()
     33{
     34    return WebKit::toAPI(API::WebsiteDataStore::APIType);
    5735}
    58 
    59 #endif // APIWebsiteDataStore_h
  • trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.h

    r181706 r181707  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef APIWebsiteDataStore_h
    27 #define APIWebsiteDataStore_h
     26#ifndef WKWebsiteDataStoreRef_h
     27#define WKWebsiteDataStoreRef_h
    2828
    29 #include "APIObject.h"
    30 #include "WebsiteDataStore.h"
    31 #include <WebCore/SessionID.h>
    32 #include <wtf/text/WTFString.h>
     29#include <WebKit/WKBase.h>
    3330
    34 namespace API {
     31#ifdef __cplusplus
     32extern "C" {
     33#endif
    3534
    36 class WebsiteDataStore final : public ObjectImpl<Object::Type::WebsiteDataStore> {
    37 public:
    38     static RefPtr<WebsiteDataStore> defaultDataStore();
    39     static RefPtr<WebsiteDataStore> createNonPersistentDataStore();
    40     virtual ~WebsiteDataStore();
     35WK_EXPORT WKTypeID WKWebsiteDataStoreGetTypeID();
    4136
    42     bool isNonPersistent();
     37#ifdef __cplusplus
     38}
     39#endif
    4340
    44     WebKit::WebsiteDataStore& websiteDataStore() { return *m_websiteDataStore; }
    45 
    46     static String websiteDataDirectoryFileSystemRepresentation(const String& directoryName);
    47 
    48 private:
    49     WebsiteDataStore(WebKit::WebsiteDataStore::Configuration);
    50     WebsiteDataStore();
    51 
    52     static WebKit::WebsiteDataStore::Configuration defaultDataStoreConfiguration();
    53 
    54     RefPtr<WebKit::WebsiteDataStore> m_websiteDataStore;
    55 };
    56 
    57 }
    58 
    59 #endif // APIWebsiteDataStore_h
     41#endif /* WKWebsiteDataStoreRef_h */
  • trunk/Source/WebKit2/UIProcess/WebKeyValueStorageManager.cpp

    r180354 r181707  
    2929#include "APIArray.h"
    3030#include "APISecurityOrigin.h"
     31#include "APIWebsiteDataStore.h"
    3132#include "LocalStorageDetails.h"
    3233#include "SecurityOriginData.h"
    3334#include "StorageManager.h"
    3435#include "WebProcessPool.h"
    35 #include "WebsiteDataStore.h"
    3636#include <wtf/NeverDestroyed.h>
    3737
     
    9191void WebKeyValueStorageManager::getKeyValueStorageOrigins(std::function<void (API::Array*, CallbackBase::Error)> callbackFunction)
    9292{
    93     StorageManager* storageManager = processPool()->websiteDataStore().storageManager();
     93    StorageManager* storageManager = processPool()->websiteDataStore().websiteDataStore().storageManager();
    9494    if (!storageManager) {
    9595        RunLoop::main().dispatch([callbackFunction] {
     
    111111void WebKeyValueStorageManager::getStorageDetailsByOrigin(std::function<void (API::Array*, CallbackBase::Error)> callbackFunction)
    112112{
    113     StorageManager* storageManager = processPool()->websiteDataStore().storageManager();
     113    StorageManager* storageManager = processPool()->websiteDataStore().websiteDataStore().storageManager();
    114114    if (!storageManager) {
    115115        RunLoop::main().dispatch([callbackFunction] {
     
    144144void WebKeyValueStorageManager::deleteEntriesForOrigin(API::SecurityOrigin* origin)
    145145{
    146     StorageManager* storageManager = processPool()->websiteDataStore().storageManager();
     146    StorageManager* storageManager = processPool()->websiteDataStore().websiteDataStore().storageManager();
    147147    if (!storageManager)
    148148        return;
     
    153153void WebKeyValueStorageManager::deleteAllEntries()
    154154{
    155     StorageManager* storageManager = processPool()->websiteDataStore().storageManager();
     155    StorageManager* storageManager = processPool()->websiteDataStore().websiteDataStore().storageManager();
    156156    if (!storageManager)
    157157        return;
  • trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp

    r181562 r181707  
    158158    , m_memorySamplerEnabled(false)
    159159    , m_memorySamplerInterval(1400.0)
    160     , m_websiteDataStore(WebsiteDataStore::create(websiteDataStoreConfiguration(m_configuration.get())))
     160    , m_websiteDataStore(API::WebsiteDataStore::create(websiteDataStoreConfiguration(m_configuration.get())))
    161161#if USE(SOUP)
    162162    , m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain)
     
    851851    if (!configuration.websiteDataStore) {
    852852        ASSERT(!configuration.sessionID.isValid());
    853         configuration.websiteDataStore = m_websiteDataStore.get();
     853        configuration.websiteDataStore = &m_websiteDataStore->websiteDataStore();
    854854        configuration.sessionID = configuration.preferences->privateBrowsingEnabled() ? SessionID::legacyPrivateSessionID() : SessionID::defaultSessionID();
    855855    }
  • trunk/Source/WebKit2/UIProcess/WebProcessPool.h

    r181562 r181707  
    2929#include "APIDictionary.h"
    3030#include "APIObject.h"
     31#include "APIWebsiteDataStore.h"
    3132#include "DownloadProxyMap.h"
    3233#include "GenericCallback.h"
     
    165166    void disconnectProcess(WebProcessProxy*);
    166167
    167     WebsiteDataStore& websiteDataStore() const { return *m_websiteDataStore; }
     168    API::WebsiteDataStore& websiteDataStore() const { return *m_websiteDataStore; }
    168169
    169170    PassRefPtr<WebPageProxy> createWebPage(PageClient&, WebPageConfiguration);
     
    484485#endif
    485486
    486     RefPtr<WebsiteDataStore> m_websiteDataStore;
     487    RefPtr<API::WebsiteDataStore> m_websiteDataStore;
    487488
    488489    typedef HashMap<const char*, RefPtr<WebContextSupplement>, PtrHash<const char*>> WebContextSupplementMap;
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r181442 r181707  
    275275                1A53C2A91A32572B004E8C70 /* WebsiteDataStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A53C2A41A32569F004E8C70 /* WebsiteDataStore.cpp */; };
    276276                1A53C2AA1A325730004E8C70 /* WebsiteDataStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A53C2A51A32569F004E8C70 /* WebsiteDataStore.h */; };
     277                1A57109E1ABA0027002FABBE /* WKWebsiteDataStoreRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A57109C1ABA0027002FABBE /* WKWebsiteDataStoreRef.cpp */; };
     278                1A57109F1ABA0027002FABBE /* WKWebsiteDataStoreRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A57109D1ABA0027002FABBE /* WKWebsiteDataStoreRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
    277279                1A5B1C501898606F004FCF9B /* WKNavigation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A5B1C4E1898606F004FCF9B /* WKNavigation.mm */; };
    278280                1A5B1C511898606F004FCF9B /* WKNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5B1C4F1898606F004FCF9B /* WKNavigation.h */; settings = {ATTRIBUTES = (Public, ); }; };
     
    23832385                1A53C2A41A32569F004E8C70 /* WebsiteDataStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebsiteDataStore.cpp; sourceTree = "<group>"; };
    23842386                1A53C2A51A32569F004E8C70 /* WebsiteDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteDataStore.h; sourceTree = "<group>"; };
     2387                1A57109C1ABA0027002FABBE /* WKWebsiteDataStoreRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKWebsiteDataStoreRef.cpp; sourceTree = "<group>"; };
     2388                1A57109D1ABA0027002FABBE /* WKWebsiteDataStoreRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsiteDataStoreRef.h; sourceTree = "<group>"; };
    23852389                1A5B1C4E1898606F004FCF9B /* WKNavigation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNavigation.mm; sourceTree = "<group>"; };
    23862390                1A5B1C4F1898606F004FCF9B /* WKNavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigation.h; sourceTree = "<group>"; };
     
    64296433                                7C89D2A11A678875003A5FDE /* WKUserScriptRef.cpp */,
    64306434                                7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */,
     6435                                1A57109C1ABA0027002FABBE /* WKWebsiteDataStoreRef.cpp */,
     6436                                1A57109D1ABA0027002FABBE /* WKWebsiteDataStoreRef.h */,
    64316437                        );
    64326438                        path = C;
     
    78777883                                1AFDE65A1954A42B00C48FFA /* SessionState.h in Headers */,
    78787884                                8372DB251A674C8F00C697C5 /* WKPageDiagnosticLoggingClient.h in Headers */,
     7885                                1A57109F1ABA0027002FABBE /* WKWebsiteDataStoreRef.h in Headers */,
    78797886                                1A002D49196B345D00B9AD44 /* SessionStateCoding.h in Headers */,
    78807887                                753E3E0E1887398900188496 /* SessionTracker.h in Headers */,
     
    96249631                                2D29ECD1192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.mm in Sources */,
    96259632                                1AB16ADD1648598400290D62 /* RemoteLayerTreeDrawingArea.mm in Sources */,
     9633                                1A57109E1ABA0027002FABBE /* WKWebsiteDataStoreRef.cpp in Sources */,
    96269634                                1AB16AE11648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm in Sources */,
    96279635                                0FF24A2D1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.