Remove duplicate API from WKContext
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Apr 2011 05:38:43 +0000 (05:38 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Apr 2011 05:38:43 +0000 (05:38 +0000)
<rdar://problem/8727879>
https://bugs.webkit.org/show_bug.cgi?id=57815

Reviewed by Brian Weinstein.

Source/WebKit2:

- Remove WKContextClearResourceCaches and WKContextClearApplicationCache in favor
  of their more modern counterparts WKResourceCacheManagerClearCacheForAllOrigins
  and WKApplicationCacheManagerDeleteAllEntries.

- Expand clearing functionality of WKResourceCacheManager by adding type of resources
  to clear.

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
Remove clearing bools.

* UIProcess/API/C/WKAPICast.h:
(WebKit::toResourceCachesToClear):
Update for new name of enum.

* UIProcess/API/C/WKContext.cpp:
* UIProcess/API/C/WKContext.h:
Remove WKContextClearResourceCaches and WKContextClearApplicationCache.

* UIProcess/API/C/WKResourceCacheManager.cpp:
(WKResourceCacheManagerClearCacheForOrigin):
(WKResourceCacheManagerClearCacheForAllOrigins):
* UIProcess/API/C/WKResourceCacheManager.h:
Add WKResourceCachesToClear enum and use it in the clearing functions.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext):
(WebKit::WebContext::ensureWebProcess):
* UIProcess/WebContext.h:
* WebProcess/WebProcess.messages.in:
Remove clearing functions and setting of bools for clear on launch.

* UIProcess/WebFullScreenManagerProxy.cpp:
Remove unnecessary #include.

* UIProcess/WebResourceCacheManagerProxy.cpp:
(WebKit::WebResourceCacheManagerProxy::clearCacheForOrigin):
(WebKit::WebResourceCacheManagerProxy::clearCacheForAllOrigins):
* UIProcess/WebResourceCacheManagerProxy.h:
* WebProcess/ResourceCache/WebResourceCacheManager.cpp:
(WebKit::WebResourceCacheManager::clearCacheForOrigin):
(WebKit::WebResourceCacheManager::clearCacheForAllOrigins):
* WebProcess/ResourceCache/WebResourceCacheManager.h:
* WebProcess/ResourceCache/WebResourceCacheManager.messages.in:
Add enum parameter describing what type of caches to clear.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::clearResourceCaches):
* WebProcess/WebProcess.h:
No longer need to use opaque type now that it is not a message receiver.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/SendingMessagesToTheWebProcessBeforeItIsValid.cpp: Removed.
* TestWebKitAPI/win/TestWebKitAPI.vcproj:
Remove SendingMessagesToTheWebProcessBeforeItIsValid since the API it was testing is now removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@82906 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebProcessCreationParameters.cpp
Source/WebKit2/Shared/WebProcessCreationParameters.h
Source/WebKit2/UIProcess/API/C/WKAPICast.h
Source/WebKit2/UIProcess/API/C/WKContext.cpp
Source/WebKit2/UIProcess/API/C/WKContext.h
Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp
Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContext.h
Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp
Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp
Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h
Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp
Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.h
Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.messages.in
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/WebProcess.messages.in
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/SendingMessagesToTheWebProcessBeforeItIsValid.cpp [deleted file]
Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj

index e8e0a60..28a6349 100644 (file)
@@ -1,3 +1,66 @@
+2011-04-04  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Brian Weinstein.
+
+        Remove duplicate API from WKContext
+        <rdar://problem/8727879>
+        https://bugs.webkit.org/show_bug.cgi?id=57815
+
+        - Remove WKContextClearResourceCaches and WKContextClearApplicationCache in favor
+          of their more modern counterparts WKResourceCacheManagerClearCacheForAllOrigins
+          and WKApplicationCacheManagerDeleteAllEntries.
+
+        - Expand clearing functionality of WKResourceCacheManager by adding type of resources
+          to clear.
+
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        Remove clearing bools.
+
+        * UIProcess/API/C/WKAPICast.h:
+        (WebKit::toResourceCachesToClear):
+        Update for new name of enum.
+
+        * UIProcess/API/C/WKContext.cpp:
+        * UIProcess/API/C/WKContext.h:
+        Remove WKContextClearResourceCaches and WKContextClearApplicationCache.
+
+        * UIProcess/API/C/WKResourceCacheManager.cpp:
+        (WKResourceCacheManagerClearCacheForOrigin):
+        (WKResourceCacheManagerClearCacheForAllOrigins):
+        * UIProcess/API/C/WKResourceCacheManager.h:
+        Add WKResourceCachesToClear enum and use it in the clearing functions.
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::WebContext):
+        (WebKit::WebContext::ensureWebProcess):
+        * UIProcess/WebContext.h:
+        * WebProcess/WebProcess.messages.in:
+        Remove clearing functions and setting of bools for clear on launch.
+
+        * UIProcess/WebFullScreenManagerProxy.cpp:
+        Remove unnecessary #include.
+
+        * UIProcess/WebResourceCacheManagerProxy.cpp:
+        (WebKit::WebResourceCacheManagerProxy::clearCacheForOrigin):
+        (WebKit::WebResourceCacheManagerProxy::clearCacheForAllOrigins):
+        * UIProcess/WebResourceCacheManagerProxy.h:
+        * WebProcess/ResourceCache/WebResourceCacheManager.cpp:
+        (WebKit::WebResourceCacheManager::clearCacheForOrigin):
+        (WebKit::WebResourceCacheManager::clearCacheForAllOrigins):
+        * WebProcess/ResourceCache/WebResourceCacheManager.h:
+        * WebProcess/ResourceCache/WebResourceCacheManager.messages.in:
+        Add enum parameter describing what type of caches to clear.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+        (WebKit::WebProcess::clearResourceCaches):
+        * WebProcess/WebProcess.h:
+        No longer need to use opaque type now that it is not a message receiver.
+
 2011-04-04  David Kilzer  <ddkilzer@apple.com>
 
         <http://webkit.org/b/57384> CFNetwork and WebCore load priorities should match
index db3cd4c..651aaf1 100644 (file)
@@ -32,8 +32,6 @@ namespace WebKit {
 
 WebProcessCreationParameters::WebProcessCreationParameters()
     : shouldTrackVisitedLinks(false)
-    , clearResourceCaches(false)
-    , clearApplicationCache(false)
     , shouldAlwaysUseComplexTextCodePath(false)
     , defaultRequestTimeoutInterval(INT_MAX)
 #if PLATFORM(MAC)
@@ -58,8 +56,6 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
     encoder->encode(mimeTypesWithCustomRepresentation);
     encoder->encodeEnum(cacheModel);
     encoder->encode(shouldTrackVisitedLinks);
-    encoder->encode(clearResourceCaches);
-    encoder->encode(clearApplicationCache);
     encoder->encode(shouldAlwaysUseComplexTextCodePath);
     encoder->encode(iconDatabaseEnabled);
     encoder->encode(languageCode);
@@ -109,10 +105,6 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
         return false;
     if (!decoder->decode(parameters.shouldTrackVisitedLinks))
         return false;
-    if (!decoder->decode(parameters.clearResourceCaches))
-        return false;
-    if (!decoder->decode(parameters.clearApplicationCache))
-        return false;
     if (!decoder->decode(parameters.shouldAlwaysUseComplexTextCodePath))
         return false;
     if (!decoder->decode(parameters.iconDatabaseEnabled))
index 835362f..faac556 100644 (file)
@@ -64,9 +64,6 @@ struct WebProcessCreationParameters {
 
     CacheModel cacheModel;
     bool shouldTrackVisitedLinks;
-    
-    bool clearResourceCaches;
-    bool clearApplicationCache;
 
     bool shouldAlwaysUseComplexTextCodePath;
 
index a440c6f..4cc1e3d 100644 (file)
@@ -37,6 +37,7 @@
 #include "WKPage.h"
 #include "WKPreferencesPrivate.h"
 #include "WKProtectionSpaceTypes.h"
+#include "WKResourceCacheManager.h"
 #include "WKSharedAPICast.h"
 #include <WebCore/CookieJar.h>
 #include <WebCore/Credential.h>
@@ -246,9 +247,9 @@ inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersis
 inline ResourceCachesToClear toResourceCachesToClear(WKResourceCachesToClear wkResourceCachesToClear)
 {
     switch (wkResourceCachesToClear) {
-    case kWKAllResourceCaches:
+    case WKResourceCachesToClearAll:
         return AllResourceCaches;
-    case kWKInMemoryResourceCachesOnly:
+    case WKResourceCachesToClearInMemoryOnly:
         return InMemoryResourceCachesOnly;
     }
 
index bf196b7..a23a582 100644 (file)
@@ -148,16 +148,6 @@ void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef contextRef,
     toImpl(contextRef)->setDomainRelaxationForbiddenForURLScheme(toImpl(urlScheme)->string());
 }
 
-void WKContextClearResourceCaches(WKContextRef contextRef, WKResourceCachesToClear cachesToClear)
-{
-    toImpl(contextRef)->clearResourceCaches(toResourceCachesToClear(cachesToClear));
-}
-
-void WKContextClearApplicationCache(WKContextRef contextRef)
-{
-    toImpl(contextRef)->clearApplicationCache();
-}
-
 WKCookieManagerRef WKContextGetCookieManager(WKContextRef contextRef)
 {
     return toAPI(toImpl(contextRef)->cookieManagerProxy());
index 606574f..7447fad 100644 (file)
@@ -39,12 +39,6 @@ enum {
 };
 typedef uint32_t WKCacheModel;
 
-enum {
-    kWKAllResourceCaches = 0,
-    kWKInMemoryResourceCachesOnly = 1
-};
-typedef uint32_t WKResourceCachesToClear;
-
 // Injected Bundle Client
 typedef void (*WKContextDidReceiveMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo);
 typedef void (*WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void *clientInfo);
@@ -125,9 +119,6 @@ WK_EXPORT void WKContextAddVisitedLink(WKContextRef context, WKStringRef visited
 WK_EXPORT void WKContextSetCacheModel(WKContextRef context, WKCacheModel cacheModel);
 WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context);
 
-WK_EXPORT void WKContextClearResourceCaches(WKContextRef context, WKResourceCachesToClear cachesToClear);
-WK_EXPORT void WKContextClearApplicationCache(WKContextRef context);
-
 WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef interval);
 WK_EXPORT void WKContextStopMemorySampler(WKContextRef context);
 
index 483beeb..a5711e0 100644 (file)
@@ -41,12 +41,12 @@ void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef cacheManage
     toImpl(cacheManagerRef)->getCacheOrigins(ArrayCallback::create(context, callback));
 }
 
-void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManagerRef, WKSecurityOriginRef originRef)
+void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManagerRef, WKSecurityOriginRef originRef, WKResourceCachesToClear cachesToClear)
 {
-    toImpl(cacheManagerRef)->clearCacheForOrigin(toImpl(originRef));
+    toImpl(cacheManagerRef)->clearCacheForOrigin(toImpl(originRef), toResourceCachesToClear(cachesToClear));
 }
 
-void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManagerRef)
+void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManagerRef, WKResourceCachesToClear cachesToClear)
 {
-    toImpl(cacheManagerRef)->clearCacheForAllOrigins();    
+    toImpl(cacheManagerRef)->clearCacheForAllOrigins(toResourceCachesToClear(cachesToClear));
 }
index 479169d..80c4531 100644 (file)
 extern "C" {
 #endif
 
+enum {
+    WKResourceCachesToClearAll = 0,
+    WKResourceCachesToClearInMemoryOnly = 1
+};
+typedef uint32_t WKResourceCachesToClear;
+
 WK_EXPORT WKTypeID WKResourceCacheManagerGetTypeID();
 
 typedef void (*WKResourceCacheManagerGetCacheOriginsFunction)(WKArrayRef, WKErrorRef, void*);
 WK_EXPORT void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef contextRef, void* context, WKResourceCacheManagerGetCacheOriginsFunction function);
 
-WK_EXPORT void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManger, WKSecurityOriginRef origin);
-WK_EXPORT void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManager);
+WK_EXPORT void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManger, WKSecurityOriginRef origin, WKResourceCachesToClear cachesToClear);
+WK_EXPORT void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManager, WKResourceCachesToClear cachesToClear);
 
 #ifdef __cplusplus
 }
index 8cf9885..ff211d1 100644 (file)
@@ -111,8 +111,6 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
     , m_visitedLinkProvider(this)
     , m_alwaysUsesComplexTextCodePath(false)
     , m_cacheModel(CacheModelDocumentViewer)
-    , m_clearResourceCachesForNewWebProcess(false)
-    , m_clearApplicationCacheForNewWebProcess(false)
     , m_memorySamplerEnabled(false)
     , m_memorySamplerInterval(1400.0)
     , m_applicationCacheManagerProxy(WebApplicationCacheManagerProxy::create(this))
@@ -235,14 +233,9 @@ void WebContext::ensureWebProcess()
     parameters.applicationCacheDirectory = applicationCacheDirectory();
     parameters.databaseDirectory = databaseDirectory();
     parameters.localStorageDirectory = localStorageDirectory();
-    parameters.clearResourceCaches = m_clearResourceCachesForNewWebProcess;
-    parameters.clearApplicationCache = m_clearApplicationCacheForNewWebProcess;
 #if PLATFORM(MAC)
     parameters.presenterApplicationPid = getpid();
 #endif
-
-    m_clearResourceCachesForNewWebProcess = false;
-    m_clearApplicationCacheForNewWebProcess = false;
     
     copyToVector(m_schemesToRegisterAsEmptyDocument, parameters.urlSchemesRegistererdAsEmptyDocument);
     copyToVector(m_schemesToRegisterAsSecure, parameters.urlSchemesRegisteredAsSecure);
@@ -672,31 +665,6 @@ CoreIPC::SyncReplyMode WebContext::didReceiveSyncMessage(CoreIPC::Connection* co
     return CoreIPC::AutomaticReply;
 }
 
-void WebContext::clearResourceCaches(ResourceCachesToClear cachesToClear)
-{
-    if (sendToAllProcesses(Messages::WebProcess::ClearResourceCaches(cachesToClear)))
-        return;
-
-    if (cachesToClear == InMemoryResourceCachesOnly)
-        return;
-
-    // FIXME <rdar://problem/8727879>: Setting this flag ensures that the next time a WebProcess is created, this request to
-    // clear the resource cache will be respected. But if the user quits the application before another WebProcess is created,
-    // their request will be ignored.
-    m_clearResourceCachesForNewWebProcess = true;
-}
-
-void WebContext::clearApplicationCache()
-{
-    if (sendToAllProcesses(Messages::WebProcess::ClearApplicationCache()))
-        return;
-
-    // FIXME <rdar://problem/8727879>: Setting this flag ensures that the next time a WebProcess is created, this request to
-    // clear the application cache will be respected. But if the user quits the application before another WebProcess is created,
-    // their request will be ignored.
-    m_clearApplicationCacheForNewWebProcess = true;
-}
-   
 void WebContext::setEnhancedAccessibility(bool flag)
 {
     sendToAllProcesses(Messages::WebProcess::SetEnhancedAccessibility(flag));
index c5f9f63..3f3f480 100644 (file)
@@ -122,8 +122,6 @@ public:
 
     void setCacheModel(CacheModel);
     CacheModel cacheModel() const { return m_cacheModel; }
-    void clearResourceCaches(ResourceCachesToClear);
-    void clearApplicationCache();
 
     void setDefaultRequestTimeoutInterval(double);
 
@@ -236,9 +234,6 @@ private:
 
     WebDownloadClient m_downloadClient;
     HashMap<uint64_t, RefPtr<DownloadProxy> > m_downloads;
-
-    bool m_clearResourceCachesForNewWebProcess;
-    bool m_clearApplicationCacheForNewWebProcess;
     
     bool m_memorySamplerEnabled;
     double m_memorySamplerInterval;
index 91daf10..f25bb41 100644 (file)
@@ -31,7 +31,6 @@
 #include "WebContext.h"
 #include "WebFullScreenManagerMessages.h"
 #include "WebFullScreenManagerProxyMessages.h"
-#include "WebProcess.h"
 
 namespace WebKit {
 
index b71ab35..8c06bdc 100644 (file)
@@ -78,19 +78,19 @@ void WebResourceCacheManagerProxy::didGetCacheOrigins(const Vector<SecurityOrigi
     performAPICallbackWithSecurityOriginDataVector(origins, callback.get());
 }
 
-void WebResourceCacheManagerProxy::clearCacheForOrigin(WebSecurityOrigin* origin)
+void WebResourceCacheManagerProxy::clearCacheForOrigin(WebSecurityOrigin* origin, ResourceCachesToClear cachesToClear)
 {
     SecurityOriginData securityOrigin;
     securityOrigin.protocol = origin->protocol();
     securityOrigin.host = origin->host();
     securityOrigin.port = origin->port();
 
-    m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebResourceCacheManager::ClearCacheForOrigin(securityOrigin));
+    m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebResourceCacheManager::ClearCacheForOrigin(securityOrigin, cachesToClear));
 }
 
-void WebResourceCacheManagerProxy::clearCacheForAllOrigins()
+void WebResourceCacheManagerProxy::clearCacheForAllOrigins(ResourceCachesToClear cachesToClear)
 {
-    m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebResourceCacheManager::ClearCacheForAllOrigins());
+    m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebResourceCacheManager::ClearCacheForAllOrigins(cachesToClear));
 }
 
 } // namespace WebKit
index 1a360b4..f0c7bb5 100644 (file)
@@ -29,6 +29,7 @@
 #include "APIObject.h"
 #include "Arguments.h"
 #include "GenericCallback.h"
+#include "ResourceCachesToClear.h"
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 
@@ -58,8 +59,8 @@ public:
     void clearContext() { m_webContext = 0; }
 
     void getCacheOrigins(PassRefPtr<ArrayCallback>);
-    void clearCacheForOrigin(WebSecurityOrigin*);
-    void clearCacheForAllOrigins();
+    void clearCacheForOrigin(WebSecurityOrigin*, ResourceCachesToClear);
+    void clearCacheForAllOrigins(ResourceCachesToClear);
 
     void didReceiveWebResourceCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
index 1596319..2632d3b 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "Connection.h"
 #include "MessageID.h"
+#include "ResourceCachesToClear.h"
 #include "SecurityOriginData.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebResourceCacheManagerProxyMessages.h"
@@ -96,8 +97,10 @@ void WebResourceCacheManager::getCacheOrigins(uint64_t callbackID) const
     WebProcess::shared().terminateIfPossible();
 }
 
-void WebResourceCacheManager::clearCacheForOrigin(SecurityOriginData originData) const
+void WebResourceCacheManager::clearCacheForOrigin(SecurityOriginData originData, uint32_t cachesToClear) const
 {
+    ResourceCachesToClear resourceCachesToClear = static_cast<ResourceCachesToClear>(cachesToClear);
+
     RefPtr<SecurityOrigin> origin = SecurityOrigin::create(originData.protocol, originData.host, originData.port);
     if (!origin)
         return;
@@ -105,18 +108,22 @@ void WebResourceCacheManager::clearCacheForOrigin(SecurityOriginData originData)
     memoryCache()->removeResourcesWithOrigin(origin.get());
 
 #if USE(CFURLCACHE)
-    RetainPtr<CFMutableArrayRef> hostArray(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
-    RetainPtr<CFStringRef> host(AdoptCF, origin->host().createCFString());
-    CFArrayAppendValue(hostArray.get(), host.get());
+    if (resourceCachesToClear != InMemoryResourceCachesOnly) { 
+        RetainPtr<CFMutableArrayRef> hostArray(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+        RetainPtr<CFStringRef> host(AdoptCF, origin->host().createCFString());
+        CFArrayAppendValue(hostArray.get(), host.get());
 
-    clearCFURLCacheForHostNames(hostArray.get());
+        clearCFURLCacheForHostNames(hostArray.get());
+    }
 #endif
     WebProcess::shared().terminateIfPossible();
 }
 
-void WebResourceCacheManager::clearCacheForAllOrigins() const
+void WebResourceCacheManager::clearCacheForAllOrigins(uint32_t cachesToClear) const
 {
-    WebProcess::shared().clearResourceCaches();
+    ResourceCachesToClear resourceCachesToClear = static_cast<ResourceCachesToClear>(cachesToClear);
+
+    WebProcess::shared().clearResourceCaches(resourceCachesToClear);
     WebProcess::shared().terminateIfPossible();
 }
 
index 3a29a4b..0172389 100644 (file)
@@ -27,6 +27,7 @@
 #define WebResourceCacheManager_h
 
 #include "Arguments.h"
+#include "ResourceCachesToClear.h"
 #include <wtf/Noncopyable.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/text/WTFString.h>
@@ -56,8 +57,8 @@ private:
     void didReceiveWebResourceCacheManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
     void getCacheOrigins(uint64_t callbackID) const;
-    void clearCacheForOrigin(SecurityOriginData origin) const;
-    void clearCacheForAllOrigins() const;
+    void clearCacheForOrigin(SecurityOriginData, uint32_t cachesToClear) const;
+    void clearCacheForAllOrigins(uint32_t cachesToClear) const;
 
 #if USE(CFURLCACHE)
     static RetainPtr<CFArrayRef> cfURLCacheHostNames();
index b6d5900..336b253 100644 (file)
@@ -22,6 +22,6 @@
 
 messages -> WebResourceCacheManager {
     void GetCacheOrigins(uint64_t callbackID)
-    void ClearCacheForOrigin(WebKit::SecurityOriginData originIdentifier)
-    void ClearCacheForAllOrigins()
+    void ClearCacheForOrigin(WebKit::SecurityOriginData originIdentifier, uint32_t cachesToClear)
+    void ClearCacheForAllOrigins(uint32_t cachesToClear)
 }
index ba3290b..a14aaf5 100644 (file)
@@ -214,11 +214,6 @@ void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parame
 
     for (size_t i = 0; i < parameters.mimeTypesWithCustomRepresentation.size(); ++i)
         m_mimeTypesWithCustomRepresentations.add(parameters.mimeTypesWithCustomRepresentation[i]);
-
-    if (parameters.clearResourceCaches)
-        clearResourceCaches();
-    if (parameters.clearApplicationCache)
-        clearApplicationCache();
     
 #if PLATFORM(MAC)
     m_presenterApplicationPid = parameters.presenterApplicationPid;
@@ -702,10 +697,8 @@ WebPageGroupProxy* WebProcess::webPageGroup(const WebPageGroupData& pageGroupDat
     return result.first->second.get();
 }
 
-void WebProcess::clearResourceCaches(uint32_t cachesToClear)
+void WebProcess::clearResourceCaches(ResourceCachesToClear resourceCachesToClear)
 {
-    ResourceCachesToClear resourceCachesToClear = static_cast<ResourceCachesToClear>(cachesToClear);
-
     platformClearResourceCaches(resourceCachesToClear);
 
     // Toggling the cache model like this forces the cache to evict all its in-memory resources.
index d666910..a41c41e 100644 (file)
@@ -119,7 +119,7 @@ public:
     // Geolocation
     WebGeolocationManager& geolocationManager() { return m_geolocationManager; }
 
-    void clearResourceCaches(uint32_t cachesToClear = AllResourceCaches);
+    void clearResourceCaches(ResourceCachesToClear = AllResourceCaches);
     
     const String& localStorageDirectory() const { return m_localStorageDirectory; }
 
index 36155a7..f50c979 100644 (file)
@@ -50,16 +50,13 @@ messages -> WebProcess {
     GetSitesWithPluginData(Vector<WTF::String> pluginPaths, uint64_t callbackID)
     ClearPluginSiteData(Vector<WTF::String> pluginPaths, Vector<WTF::String> sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID)
 #endif
-
-    ClearResourceCaches(uint32_t cachesToClear);
-    ClearApplicationCache();
     
     void StartMemorySampler(WebKit::SandboxExtension::Handle sampleLogFileHandle, WTF::String sampleLogFilePath, double interval);
     void StopMemorySampler();
 
     # Downloads. This should really be in a Download.messages.in, but it seemed unnecessary to create a new file just for
     # two messages.
-    void DownloadRequest(uint64_t downloadID, uint64_t initiatingPageID, WebCore::ResourceRequest request)
+    DownloadRequest(uint64_t downloadID, uint64_t initiatingPageID, WebCore::ResourceRequest request)
     CancelDownload(uint64_t downloadID)
 
     SetTextCheckerState(WebKit::TextCheckerState textCheckerState)
index 7fd9127..8a58f26 100644 (file)
@@ -1,3 +1,16 @@
+2011-04-04  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Brian Weinstein.
+
+        Remove duplicate API from WKContext
+        <rdar://problem/8727879>
+        https://bugs.webkit.org/show_bug.cgi?id=57815
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/SendingMessagesToTheWebProcessBeforeItIsValid.cpp: Removed.
+        * TestWebKitAPI/win/TestWebKitAPI.vcproj:
+        Remove SendingMessagesToTheWebProcessBeforeItIsValid since the API it was testing is now removed.
+
 2011-04-04  Tony Chang  <tony@chromium.org>
 
         Reviewed by Ojan Vafai.
index c5c9555..86b691d 100644 (file)
@@ -57,7 +57,6 @@
                C0ADBE9612FCA79B00D2C129 /* simple-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C0ADBE8412FCA6B600D2C129 /* simple-form.html */; };
                C0BD669D131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0BD669C131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp */; };
                C0BD669F131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */; };
-               F6C59E38132AC5E000176C09 /* SendingMessagesToTheWebProcessBeforeItIsValid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6C59E37132AC5DF00176C09 /* SendingMessagesToTheWebProcessBeforeItIsValid.cpp */; };
                F6F3F29113342FEB00A6BF19 /* CookieManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */; };
 /* End PBXBuildFile section */
 
                C0ADBE8412FCA6B600D2C129 /* simple-form.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-form.html"; sourceTree = "<group>"; };
                C0BD669C131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResponsivenessTimerDoesntFireEarly.cpp; sourceTree = "<group>"; };
                C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResponsivenessTimerDoesntFireEarly_Bundle.cpp; sourceTree = "<group>"; };
-               F6C59E37132AC5DF00176C09 /* SendingMessagesToTheWebProcessBeforeItIsValid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SendingMessagesToTheWebProcessBeforeItIsValid.cpp; sourceTree = "<group>"; };
                F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CookieManager.cpp; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
                                C0BD669C131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp */,
                                C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */,
                                C0ADBE8212FCA6AA00D2C129 /* RestoreSessionStateContainingFormData.cpp */,
-                               F6C59E37132AC5DF00176C09 /* SendingMessagesToTheWebProcessBeforeItIsValid.cpp */,
                                C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */,
                                BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */,
                                BC90995D12567BC100083756 /* WKString.cpp */,
                                1ADBEFAE130C689C00D61D19 /* ForceRepaint.cpp in Sources */,
                                4BFDFFA9131477770061F24B /* HitTestResultNodeHandle.cpp in Sources */,
                                C0BD669D131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp in Sources */,
-                               F6C59E38132AC5E000176C09 /* SendingMessagesToTheWebProcessBeforeItIsValid.cpp in Sources */,
                                BC246D8E132F115A00B56D7C /* AboutBlankLoad.cpp in Sources */,
                                BC246D9A132F1FE100B56D7C /* CanHandleRequest.cpp in Sources */,
                                F6F3F29113342FEB00A6BF19 /* CookieManager.cpp in Sources */,
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/SendingMessagesToTheWebProcessBeforeItIsValid.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/SendingMessagesToTheWebProcessBeforeItIsValid.cpp
deleted file mode 100644 (file)
index d48ba31..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "Test.h"
-
-#include <WebKit2/WKRetainPtr.h>
-#include <WebKit2/WKContext.h>
-
-namespace TestWebKitAPI {
-
-TEST(WebKit2, SendingMessagesToTheWebProcessBeforeItIsValid)
-{
-    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
-
-    // Neither of these calls should cause a crash.
-    WKContextClearResourceCaches(context.get(), kWKAllResourceCaches);
-    WKContextClearResourceCaches(context.get(), kWKInMemoryResourceCachesOnly);
-}
-
-} // namespace TestWebKitAPI
index 468ed71..46e855e 100644 (file)
                                        >
                                </File>
                                <File
-                                       RelativePath="..\Tests\WebKit2\SendingMessagesToTheWebProcessBeforeItIsValid.cpp"
-                                       >
-                               </File>
-                               <File
                                        RelativePath="..\Tests\WebKit2\simple-accelerated-compositing.html"
                                        >
                                </File>