[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
darin at apple.com
darin at apple.com
Wed Dec 22 16:14:05 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 7316ce5de0b6742151fcabd839ab9d197726a6b2
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Nov 19 22:23:24 2010 +0000
2010-11-19 Darin Adler <darin at apple.com>
Reviewed by Sam Weinig.
Need a way to clear disk cache from WebContext
https://bugs.webkit.org/show_bug.cgi?id=49820
* UIProcess/API/C/WKContext.cpp:
(WKContextClearResourceCaches): Added.
(WKContextClearApplicationCache): Added.
* UIProcess/API/C/WKContext.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::clearResourceCaches): Added.
(WebKit::WebContext::clearApplicationCache): Added.
* UIProcess/WebContext.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::clearResourceCaches): Added.
(WebKit::WebProcess::clearApplicationCache): Added.
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in: Added messages.
* WebProcess/mac/WebProcessMac.mm:
(WebKit::WebProcess::platformClearResourceCaches): Added.
* WebProcess/qt/WebProcessQt.cpp:
(WebKit::WebProcess::platformClearResourceCaches): Added.
* WebProcess/win/WebProcessWin.cpp:
(WebKit::WebProcess::platformClearResourceCaches): Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 2030b05..d68cea5 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,30 @@
+2010-11-19 Darin Adler <darin at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Need a way to clear disk cache from WebContext
+ https://bugs.webkit.org/show_bug.cgi?id=49820
+
+ * UIProcess/API/C/WKContext.cpp:
+ (WKContextClearResourceCaches): Added.
+ (WKContextClearApplicationCache): Added.
+ * UIProcess/API/C/WKContext.h:
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::clearResourceCaches): Added.
+ (WebKit::WebContext::clearApplicationCache): Added.
+ * UIProcess/WebContext.h:
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::clearResourceCaches): Added.
+ (WebKit::WebProcess::clearApplicationCache): Added.
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in: Added messages.
+ * WebProcess/mac/WebProcessMac.mm:
+ (WebKit::WebProcess::platformClearResourceCaches): Added.
+ * WebProcess/qt/WebProcessQt.cpp:
+ (WebKit::WebProcess::platformClearResourceCaches): Added.
+ * WebProcess/win/WebProcessWin.cpp:
+ (WebKit::WebProcess::platformClearResourceCaches): Added.
+
2010-11-19 Anders Carlsson <andersca at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebKit2/UIProcess/API/C/WKContext.cpp b/WebKit2/UIProcess/API/C/WKContext.cpp
index 48f8011..ba32317 100644
--- a/WebKit2/UIProcess/API/C/WKContext.cpp
+++ b/WebKit2/UIProcess/API/C/WKContext.cpp
@@ -142,3 +142,13 @@ void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef contextRef,
{
toImpl(contextRef)->setDomainRelaxationForbiddenForURLScheme(toImpl(urlScheme)->string());
}
+
+void WKContextClearResourceCaches(WKContextRef contextRef)
+{
+ toImpl(contextRef)->clearResourceCaches();
+}
+
+void WKContextClearApplicationCache(WKContextRef contextRef)
+{
+ toImpl(contextRef)->clearApplicationCache();
+}
diff --git a/WebKit2/UIProcess/API/C/WKContext.h b/WebKit2/UIProcess/API/C/WKContext.h
index 4585561..cdad0ff 100644
--- a/WebKit2/UIProcess/API/C/WKContext.h
+++ b/WebKit2/UIProcess/API/C/WKContext.h
@@ -112,6 +112,9 @@ 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);
+WK_EXPORT void WKContextClearApplicationCache(WKContextRef context);
+
#ifdef __cplusplus
}
#endif
diff --git a/WebKit2/UIProcess/WebContext.cpp b/WebKit2/UIProcess/WebContext.cpp
index 585bd69..1993eab 100644
--- a/WebKit2/UIProcess/WebContext.cpp
+++ b/WebKit2/UIProcess/WebContext.cpp
@@ -490,4 +490,14 @@ CoreIPC::SyncReplyMode WebContext::didReceiveSyncMessage(CoreIPC::Connection* co
return CoreIPC::AutomaticReply;
}
+void WebContext::clearResourceCaches()
+{
+ m_process->send(Messages::WebProcess::ClearResourceCaches(), 0);
+}
+
+void WebContext::clearApplicationCache()
+{
+ m_process->send(Messages::WebProcess::ClearApplicationCache(), 0);
+}
+
} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebContext.h b/WebKit2/UIProcess/WebContext.h
index 3365d55..7df33c7 100644
--- a/WebKit2/UIProcess/WebContext.h
+++ b/WebKit2/UIProcess/WebContext.h
@@ -114,6 +114,8 @@ public:
void setCacheModel(CacheModel);
CacheModel cacheModel() const { return m_cacheModel; }
+ void clearResourceCaches();
+ void clearApplicationCache();
#if PLATFORM(WIN)
void setShouldPaintNativeControls(bool);
diff --git a/WebKit2/WebProcess/WebProcess.cpp b/WebKit2/WebProcess/WebProcess.cpp
index 3a6d232..8190750 100644
--- a/WebKit2/WebProcess/WebProcess.cpp
+++ b/WebKit2/WebProcess/WebProcess.cpp
@@ -41,6 +41,7 @@
#include "WebProcessMessages.h"
#include "WebProcessProxyMessages.h"
#include <WebCore/ApplicationCacheStorage.h>
+#include <WebCore/CrossOriginPreflightResultCache.h>
#include <WebCore/Language.h>
#include <WebCore/Page.h>
#include <WebCore/PageGroup.h>
@@ -525,4 +526,26 @@ void WebProcess::removeWebFrame(uint64_t frameID)
m_connection->send(Messages::WebProcessProxy::DidDestroyFrame(frameID), 0);
}
+void WebProcess::clearResourceCaches()
+{
+ platformClearResourceCaches();
+
+ // Toggling the cache model like this forces the cache to evict all its in-memory resources.
+ // FIXME: We need a better way to do this.
+ CacheModel cacheModel = m_cacheModel;
+ setCacheModel(CacheModelDocumentViewer);
+ setCacheModel(cacheModel);
+
+ // Empty the cross-origin preflight cache.
+ CrossOriginPreflightResultCache::shared().empty();
+}
+
+void WebProcess::clearApplicationCache()
+{
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ // Empty the application cache.
+ cacheStorage().empty();
+#endif
+}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/WebProcess.h b/WebKit2/WebProcess/WebProcess.h
index 2e54659..ac0e52f 100644
--- a/WebKit2/WebProcess/WebProcess.h
+++ b/WebKit2/WebProcess/WebProcess.h
@@ -108,6 +108,9 @@ private:
static void calculateCacheSizes(CacheModel cacheModel, uint64_t memorySize, uint64_t diskFreeSize,
unsigned& cacheTotalCapacity, unsigned& cacheMinDeadCapacity, unsigned& cacheMaxDeadCapacity, double& deadDecodedDataDeletionInterval,
unsigned& pageCacheCapacity, unsigned long& urlCacheMemoryCapacity, unsigned long& urlCacheDiskCapacity);
+ void clearResourceCaches();
+ void platformClearResourceCaches();
+ void clearApplicationCache();
// CoreIPC::Connection::Client
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
diff --git a/WebKit2/WebProcess/WebProcess.messages.in b/WebKit2/WebProcess/WebProcess.messages.in
index 1c41a1c..a4626c5 100644
--- a/WebKit2/WebProcess/WebProcess.messages.in
+++ b/WebKit2/WebProcess/WebProcess.messages.in
@@ -42,4 +42,7 @@ messages -> WebProcess {
#if PLATFORM(WIN)
SetShouldPaintNativeControls(bool shouldPaintNativeControls)
#endif
+
+ ClearResourceCaches();
+ ClearApplicationCache();
}
diff --git a/WebKit2/WebProcess/mac/WebProcessMac.mm b/WebKit2/WebProcess/mac/WebProcessMac.mm
index 387d521..8aeccbd 100644
--- a/WebKit2/WebProcess/mac/WebProcessMac.mm
+++ b/WebKit2/WebProcess/mac/WebProcessMac.mm
@@ -96,4 +96,9 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel)
[nsurlCache setDiskCapacity:max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn.
}
+void WebProcess::platformClearResourceCaches()
+{
+ [[NSURLCache sharedURLCache] removeAllCachedResponses];
+}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/qt/WebProcessQt.cpp b/WebKit2/WebProcess/qt/WebProcessQt.cpp
index faec27b..292eaa2 100644
--- a/WebKit2/WebProcess/qt/WebProcessQt.cpp
+++ b/WebKit2/WebProcess/qt/WebProcessQt.cpp
@@ -27,9 +27,13 @@
namespace WebKit {
-void WebProcess::platformSetCacheModel(CacheModel cacheModel)
+void WebProcess::platformSetCacheModel(CacheModel)
{
// FIXME: Implement.
}
+void WebProcess::platformClearResourceCaches()
+{
+}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/win/WebProcessWin.cpp b/WebKit2/WebProcess/win/WebProcessWin.cpp
index f8a443f..7c82b0e 100644
--- a/WebKit2/WebProcess/win/WebProcessWin.cpp
+++ b/WebKit2/WebProcess/win/WebProcessWin.cpp
@@ -95,4 +95,11 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel)
#endif
}
+void WebProcess::platformClearResourceCaches()
+{
+#if USE(CFNETWORK)
+ CFURLCacheRemoveAllCachedResponses(RetainPtr<CFURLCacheRef>(AdoptCF, CFURLCacheCopySharedURLCache()).get());
+#endif
+}
+
} // namespace WebKit
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list