as the WebCore memory cache.
https://bugs.webkit.org/show_bug.cgi?id=54886
Part of <rdar://problem/
8971738>
Reviewed by Adam Roben.
Add a new use flag for using the CFURLCache.
* wtf/Platform.h:
Source/WebKit2: WebResourceCacheManager should be responsible for managing the CFURLCache as well
as the WebCore memory cache.
https://bugs.webkit.org/show_bug.cgi?id=54886
Part of <rdar://problem/
8971738>
Reviewed by Adam Roben.
* WebProcess/ResourceCache/WebResourceCacheManager.cpp:
(WebKit::WebResourceCacheManager::getCacheOrigins): Call through to cFURLCacheHostNames, and add
create SecurityOrigin's for them and add them to the set of SecurityOrigins with cache.
(WebKit::WebResourceCacheManager::clearCacheForOrigin): Call through to clear the CFURLCache for
the origin's hostname.
* WebProcess/ResourceCache/WebResourceCacheManager.h:
* WebProcess/ResourceCache/cf: Added.
* WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp: Added.
(WebKit::WebResourceCacheManager::cfURLCacheHostNames): Call through to WebKitSystemInterface.
(WebKit::WebResourceCacheManager::clearCFURLCacheForHostNames): Ditto.
* win/WebKit2.vcproj: Added new file.
* WebKit2.xcodeproj/project.pbxproj: Ditto.
WebKitLibraries: WebResourceCacheManager should be responsible for managing the CFURLCache as well
as the WebCore memory cache.
https://bugs.webkit.org/show_bug.cgi?id=54886
Part of <rdar://problem/
8971738>
Reviewed by Adam Roben.
Update WebKitSystemInterface headers and libraries with new functions.
* WebKitSystemInterface.h:
* libWebKitSystemInterfaceLeopard.a:
* libWebKitSystemInterfaceSnowLeopard.a:
* win/include/WebKitSystemInterface/WebKitSystemInterface.h:
* win/lib/WebKitSystemInterface.lib:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79252
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-02-21 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebResourceCacheManager should be responsible for managing the CFURLCache as well
+ as the WebCore memory cache.
+ https://bugs.webkit.org/show_bug.cgi?id=54886
+ Part of <rdar://problem/8971738>
+
+ Add a new use flag for using the CFURLCache.
+
+ * wtf/Platform.h:
+
2011-02-21 Xan Lopez <xlopez@igalia.com>
Reviewed by Gavin Barraclough.
#define WTF_USE_CFNETWORK 1
#endif
+#if USE(CFNETWORK) || PLATFORM(MAC)
+#define WTF_USE_CFURLCACHE 1
+#endif
+
#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(QT)
#define ENABLE_WEB_ARCHIVE 1
#endif
+2011-02-18 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebResourceCacheManager should be responsible for managing the CFURLCache as well
+ as the WebCore memory cache.
+ https://bugs.webkit.org/show_bug.cgi?id=54886
+ Part of <rdar://problem/8971738>
+
+ * WebProcess/ResourceCache/WebResourceCacheManager.cpp:
+ (WebKit::WebResourceCacheManager::getCacheOrigins): Call through to cFURLCacheHostNames, and add
+ create SecurityOrigin's for them and add them to the set of SecurityOrigins with cache.
+ (WebKit::WebResourceCacheManager::clearCacheForOrigin): Call through to clear the CFURLCache for
+ the origin's hostname.
+ * WebProcess/ResourceCache/WebResourceCacheManager.h:
+
+ * WebProcess/ResourceCache/cf: Added.
+ * WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp: Added.
+ (WebKit::WebResourceCacheManager::cfURLCacheHostNames): Call through to WebKitSystemInterface.
+ (WebKit::WebResourceCacheManager::clearCFURLCacheForHostNames): Ditto.
+
+ * win/WebKit2.vcproj: Added new file.
+ * WebKit2.xcodeproj/project.pbxproj: Ditto.
+
2011-02-21 Adam Roben <aroben@apple.com>
Move control of the sequence number from DrawingAreaImpl to DrawingAreaProxyImpl
33367656130C9ECA006C9DE2 /* WebResourceCacheManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 33367652130C9ECA006C9DE2 /* WebResourceCacheManagerMessages.h */; };
33367657130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33367653130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessageReceiver.cpp */; };
33367658130C9ECB006C9DE2 /* WebResourceCacheManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 33367654130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessages.h */; };
+ 33F9D5B91312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33F9D5B81312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp */; };
37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
51021E9C12B16788005C033C /* WebContextMenuClientMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */; };
510FBB9A1288C95E00AFFDF4 /* WebContextMenuItemData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */; };
33367652130C9ECA006C9DE2 /* WebResourceCacheManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceCacheManagerMessages.h; sourceTree = "<group>"; };
33367653130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceCacheManagerProxyMessageReceiver.cpp; sourceTree = "<group>"; };
33367654130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceCacheManagerProxyMessages.h; sourceTree = "<group>"; };
+ 33F9D5B81312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = WebResourceCacheManagerCFNet.cpp; path = ResourceCache/cf/WebResourceCacheManagerCFNet.cpp; sourceTree = "<group>"; };
37F623B712A57B6200E3FDF6 /* WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindOptions.h; sourceTree = "<group>"; };
51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuClientMac.mm; sourceTree = "<group>"; };
510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItemData.cpp; sourceTree = "<group>"; };
3336762B130C9978006C9DE2 /* ResourceCache */ = {
isa = PBXGroup;
children = (
+ 33F9D5B71312F1B1000D683F /* cf */,
3336762C130C9998006C9DE2 /* WebResourceCacheManager.cpp */,
3336762D130C9998006C9DE2 /* WebResourceCacheManager.h */,
3336762E130C9998006C9DE2 /* WebResourceCacheManager.messages.in */,
name = ResourceCache;
sourceTree = "<group>";
};
+ 33F9D5B71312F1B1000D683F /* cf */ = {
+ isa = PBXGroup;
+ children = (
+ 33F9D5B81312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp */,
+ );
+ name = cf;
+ sourceTree = "<group>";
+ };
512F588612A8834700629530 /* Authentication */ = {
isa = PBXGroup;
children = (
33367655130C9ECA006C9DE2 /* WebResourceCacheManagerMessageReceiver.cpp in Sources */,
33367657130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessageReceiver.cpp in Sources */,
33152975130D0CB200ED2483 /* SecurityOriginData.cpp in Sources */,
+ 33F9D5B91312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
MemoryCache::SecurityOriginSet origins;
memoryCache()->getOriginsWithCache(origins);
+#if USE(CFURLCACHE)
+ RetainPtr<CFArrayRef> cfURLHosts = cfURLCacheHostNames();
+ CFIndex size = CFArrayGetCount(cfURLHosts.get());
+
+ String httpString("http");
+ for (CFIndex i = 0; i < size; ++i) {
+ CFStringRef host = static_cast<CFStringRef>(CFArrayGetValueAtIndex(cfURLHosts.get(), i));
+ origins.add(SecurityOrigin::create(httpString, host, 0));
+ }
+#endif
+
+ // Create a list with the origins in both of the caches.
Vector<SecurityOriginData> identifiers;
identifiers.reserveCapacity(origins.size());
return;
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());
+
+ clearCFURLCacheForHostNames(hostArray.get());
+#endif
}
void WebResourceCacheManager::clearCacheForAllOrigins() const
#include "Arguments.h"
#include <wtf/Noncopyable.h>
+#include <wtf/RetainPtr.h>
#include <wtf/text/WTFString.h>
namespace CoreIPC {
void getCacheOrigins(uint64_t callbackID) const;
void clearCacheForOrigin(SecurityOriginData origin) const;
void clearCacheForAllOrigins() const;
+
+#if USE(CFURLCACHE)
+ static RetainPtr<CFArrayRef> cfURLCacheHostNames();
+ static void clearCFURLCacheForHostNames(CFArrayRef);
+#endif
};
} // namespace WebKit
--- /dev/null
+/*
+ * 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 "config.h"
+#include "WebResourceCacheManager.h"
+
+#if USE(CFURLCACHE)
+
+#if PLATFORM(WIN)
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#elif PLATFORM(MAC)
+#include "WebKitSystemInterface.h"
+#endif
+
+
+namespace WebKit {
+
+#if PLATFORM(WIN)
+// The Windows version of WKSI defines these functions as capitalized, while the Mac version defines them as lower case.
+static inline CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStore() { return wkCFURLCacheCopyAllHostNamesInPersistentStore(); }
+static inline void WKCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostNames) { return wkCFURLCacheDeleteHostNamesInPersistentStore(hostNames); }
+#endif
+
+RetainPtr<CFArrayRef> WebResourceCacheManager::cfURLCacheHostNames()
+{
+ return RetainPtr<CFArrayRef>(AdoptCF, WKCFURLCacheCopyAllHostNamesInPersistentStore());
+}
+
+void WebResourceCacheManager::clearCFURLCacheForHostNames(CFArrayRef hostNames)
+{
+ WKCFURLCacheDeleteHostNamesInPersistentStore(hostNames);
+}
+
+} // namespace WebKit
+
+#endif // USE(CFURLCACHE)
<Filter
Name="ResourceCache"
>
+ <Filter
+ Name="cf"
+ >
+ <File
+ RelativePath="..\WebProcess\ResourceCache\cf\WebResourceCacheManagerCFNet.cpp"
+ >
+ </File>
+ </Filter>
<File
RelativePath="..\WebProcess\ResourceCache\WebResourceCacheManager.cpp"
>
+2011-02-21 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebResourceCacheManager should be responsible for managing the CFURLCache as well
+ as the WebCore memory cache.
+ https://bugs.webkit.org/show_bug.cgi?id=54886
+ Part of <rdar://problem/8971738>
+
+ Update WebKitSystemInterface headers and libraries with new functions.
+
+ * WebKitSystemInterface.h:
+ * libWebKitSystemInterfaceLeopard.a:
+ * libWebKitSystemInterfaceSnowLeopard.a:
+ * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
+ * win/lib/WebKitSystemInterface.lib:
+
2011-02-21 Brian Weinstein <bweinstein@apple.com>
Rubber-stamped by Dan Bernstein.
CFIndex WKGetHyphenationLocationBeforeIndex(CFStringRef string, CFIndex index);
#endif
+CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStore(void);
+void WKCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostArray);
+
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
typedef enum {
WKSandboxExtensionTypeReadOnly,
CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
+CFArrayRef wkCFURLCacheCopyAllHostNamesInPersistentStore();
+void wkCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostNames);
+
unsigned wkInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
void wkSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);