Title: [185527] trunk/Source/WebKit2
Revision
185527
Author
[email protected]
Date
2015-06-12 17:30:30 -0700 (Fri, 12 Jun 2015)

Log Message

Reimplement WKApplicationCacheManagerRef as WKWebsiteDataStoreRef
https://bugs.webkit.org/show_bug.cgi?id=145950

Reviewed by Dan Bernstein.

* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKApplicationCacheManager.cpp:
(WKApplicationCacheManagerGetTypeID):
(WKApplicationCacheManagerGetApplicationCacheOrigins):
(WKApplicationCacheManagerDeleteEntriesForOrigin):
(WKApplicationCacheManagerDeleteAllEntries):
* UIProcess/API/C/WKContext.cpp:
(WKContextGetApplicationCacheManager):
(WKContextGetPluginSiteDataManager):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (185526 => 185527)


--- trunk/Source/WebKit2/ChangeLog	2015-06-13 00:28:06 UTC (rev 185526)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-13 00:30:30 UTC (rev 185527)
@@ -1,5 +1,22 @@
 2015-06-12  Anders Carlsson  <[email protected]>
 
+        Reimplement WKApplicationCacheManagerRef as WKWebsiteDataStoreRef
+        https://bugs.webkit.org/show_bug.cgi?id=145950
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/C/WKAPICast.h:
+        * UIProcess/API/C/WKApplicationCacheManager.cpp:
+        (WKApplicationCacheManagerGetTypeID):
+        (WKApplicationCacheManagerGetApplicationCacheOrigins):
+        (WKApplicationCacheManagerDeleteEntriesForOrigin):
+        (WKApplicationCacheManagerDeleteAllEntries):
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextGetApplicationCacheManager):
+        (WKContextGetPluginSiteDataManager):
+
+2015-06-12  Anders Carlsson  <[email protected]>
+
         Clean up IndexedDB website data retrieval and removal
         https://bugs.webkit.org/show_bug.cgi?id=145941
 

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (185526 => 185527)


--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h	2015-06-13 00:28:06 UTC (rev 185526)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h	2015-06-13 00:30:30 UTC (rev 185527)
@@ -112,7 +112,6 @@
 class WebVibrationProxy;
 class WebViewportAttributes;
 
-WK_ADD_API_MAPPING(WKApplicationCacheManagerRef, WebApplicationCacheManagerProxy)
 WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy)
 WK_ADD_API_MAPPING(WKAuthenticationDecisionListenerRef, AuthenticationDecisionListener)
 WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem)

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp (185526 => 185527)


--- trunk/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp	2015-06-13 00:28:06 UTC (rev 185526)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp	2015-06-13 00:30:30 UTC (rev 185527)
@@ -26,27 +26,43 @@
 #include "config.h"
 #include "WKApplicationCacheManager.h"
 
+#include "APIWebsiteDataStore.h"
 #include "WKAPICast.h"
-#include "WebApplicationCacheManagerProxy.h"
+#include "WebsiteDataRecord.h"
 
 using namespace WebKit;
 
 WKTypeID WKApplicationCacheManagerGetTypeID()
 {
-    return toAPI(WebApplicationCacheManagerProxy::APIType);
+    return toAPI(API::WebsiteDataStore::APIType);
 }
 
-void WKApplicationCacheManagerGetApplicationCacheOrigins(WKApplicationCacheManagerRef applicationCacheManagerRef, void* context, WKApplicationCacheManagerGetApplicationCacheOriginsFunction callback)
+void WKApplicationCacheManagerGetApplicationCacheOrigins(WKApplicationCacheManagerRef applicationCacheManager, void* context, WKApplicationCacheManagerGetApplicationCacheOriginsFunction callback)
 {
-    toImpl(applicationCacheManagerRef)->getApplicationCacheOrigins(toGenericCallbackFunction(context, callback));
+    auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(applicationCacheManager))->websiteDataStore();
+    websiteDataStore.fetchData(WebsiteDataTypes::WebsiteDataTypeOfflineWebApplicationCache, [context, callback](Vector<WebsiteDataRecord> dataRecords) {
+        Vector<RefPtr<API::Object>> securityOrigins;
+        for (const auto& dataRecord : dataRecords) {
+            for (const auto& origin : dataRecord.origins)
+                securityOrigins.append(API::SecurityOrigin::create(origin));
+        }
+
+        callback(toAPI(API::Array::create(WTF::move(securityOrigins)).ptr()), nullptr, context);
+    });
 }
 
-void WKApplicationCacheManagerDeleteEntriesForOrigin(WKApplicationCacheManagerRef applicationCacheManagerRef, WKSecurityOriginRef originRef)
+void WKApplicationCacheManagerDeleteEntriesForOrigin(WKApplicationCacheManagerRef applicationCacheManager, WKSecurityOriginRef origin)
 {
-    toImpl(applicationCacheManagerRef)->deleteEntriesForOrigin(toImpl(originRef));
+    auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(applicationCacheManager))->websiteDataStore();
+
+    WebsiteDataRecord dataRecord;
+    dataRecord.add(WebsiteDataTypes::WebsiteDataTypeIndexedDBDatabases, &toImpl(origin)->securityOrigin());
+
+    websiteDataStore.removeData(WebsiteDataTypes::WebsiteDataTypeOfflineWebApplicationCache, { dataRecord }, [] { });
 }
 
-void WKApplicationCacheManagerDeleteAllEntries(WKApplicationCacheManagerRef applicationCacheManagerRef)
+void WKApplicationCacheManagerDeleteAllEntries(WKApplicationCacheManagerRef applicationCacheManager)
 {
-    toImpl(applicationCacheManagerRef)->deleteAllEntries();
+    auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(applicationCacheManager))->websiteDataStore();
+    websiteDataStore.removeData(WebsiteDataTypes::WebsiteDataTypeOfflineWebApplicationCache, std::chrono::system_clock::time_point::min(), [] { });
 }

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp (185526 => 185527)


--- trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp	2015-06-13 00:28:06 UTC (rev 185526)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp	2015-06-13 00:30:30 UTC (rev 185527)
@@ -417,9 +417,9 @@
     return toAPI(toImpl(context)->websiteDataStore());
 }
 
-WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef contextRef)
+WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef context)
 {
-    return toAPI(toImpl(contextRef)->supplement<WebApplicationCacheManagerProxy>());
+    return reinterpret_cast<WKApplicationCacheManagerRef>(WKContextGetWebsiteDataStore(context));
 }
 
 WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef contextRef)
@@ -465,7 +465,7 @@
 WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef context)
 {
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    return reinterpret_cast<WKPluginSiteDataManagerRef>(toAPI(toImpl(context)->websiteDataStore()));
+    return reinterpret_cast<WKPluginSiteDataManagerRef>(WKContextGetWebsiteDataStore(context));
 #else
     UNUSED_PARAM(context);
     return nullptr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to