Title: [145419] trunk/Source
Revision
145419
Author
[email protected]
Date
2013-03-11 15:38:27 -0700 (Mon, 11 Mar 2013)

Log Message

List cache partitions as units instead of as their contents
https://bugs.webkit.org/show_bug.cgi?id=111909

Reviewed by Maciej Stachowiak.

Source/WebCore:

Not possible to test with current automated test tools, must be tested manually.

* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::getOriginsWithCache): List a cache item as a member of a partition, if possible

Source/WebKit2:

* WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp:
(WebKit::WebResourceCacheManager::cfURLCacheHostNames): Attempt to enumerate cache partitions based on information we have

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (145418 => 145419)


--- trunk/Source/WebCore/ChangeLog	2013-03-11 22:37:41 UTC (rev 145418)
+++ trunk/Source/WebCore/ChangeLog	2013-03-11 22:38:27 UTC (rev 145419)
@@ -1,3 +1,15 @@
+2013-03-11  Jeffrey Pfau  <[email protected]>
+
+        List cache partitions as units instead of as their contents
+        https://bugs.webkit.org/show_bug.cgi?id=111909
+
+        Reviewed by Maciej Stachowiak.
+
+        Not possible to test with current automated test tools, must be tested manually.
+
+        * loader/cache/MemoryCache.cpp:
+        (WebCore::MemoryCache::getOriginsWithCache): List a cache item as a member of a partition, if possible
+
 2013-03-11  Alexey Proskuryakov  <[email protected]>
 
         Chromium build fix. Forked files strike again.

Modified: trunk/Source/WebCore/loader/cache/MemoryCache.cpp (145418 => 145419)


--- trunk/Source/WebCore/loader/cache/MemoryCache.cpp	2013-03-11 22:37:41 UTC (rev 145418)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.cpp	2013-03-11 22:38:27 UTC (rev 145419)
@@ -600,13 +600,20 @@
 
 void MemoryCache::getOriginsWithCache(SecurityOriginSet& origins)
 {
+#if ENABLE(CACHE_PARTITIONING)
+    DEFINE_STATIC_LOCAL(String, httpString, ("http"));
+#endif
     CachedResourceMap::iterator e = m_resources.end();
-    for (CachedResourceMap::iterator it = m_resources.begin(); it != e; ++it)
+    for (CachedResourceMap::iterator it = m_resources.begin(); it != e; ++it) {
 #if ENABLE(CACHE_PARTITIONING)
-        origins.add(SecurityOrigin::createFromString(it->value->begin()->value->url()));
+        if (it->value->begin()->key == emptyString())
+            origins.add(SecurityOrigin::createFromString(it->value->begin()->value->url()));
+        else
+            origins.add(SecurityOrigin::create(httpString, it->value->begin()->key, 0));
 #else
         origins.add(SecurityOrigin::createFromString(it->value->url()));
 #endif
+    }
 }
 
 void MemoryCache::removeFromLiveDecodedResourcesList(CachedResource* resource)

Modified: trunk/Source/WebKit2/ChangeLog (145418 => 145419)


--- trunk/Source/WebKit2/ChangeLog	2013-03-11 22:37:41 UTC (rev 145418)
+++ trunk/Source/WebKit2/ChangeLog	2013-03-11 22:38:27 UTC (rev 145419)
@@ -1,3 +1,13 @@
+2013-03-11  Jeffrey Pfau  <[email protected]>
+
+        List cache partitions as units instead of as their contents
+        https://bugs.webkit.org/show_bug.cgi?id=111909
+
+        Reviewed by Maciej Stachowiak.
+
+        * WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp:
+        (WebKit::WebResourceCacheManager::cfURLCacheHostNames): Attempt to enumerate cache partitions based on information we have
+
 2013-01-30  Jer Noble  <[email protected]>
 
         Full screen mode should not exit when application resigns active state.

Modified: trunk/Source/WebKit2/WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp (145418 => 145419)


--- trunk/Source/WebKit2/WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp	2013-03-11 22:37:41 UTC (rev 145418)
+++ trunk/Source/WebKit2/WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp	2013-03-11 22:38:27 UTC (rev 145419)
@@ -57,7 +57,23 @@
 
 RetainPtr<CFArrayRef> WebResourceCacheManager::cfURLCacheHostNames()
 {
-    return RetainPtr<CFArrayRef>(AdoptCF, WKCFURLCacheCopyAllHostNamesInPersistentStore());
+    RetainPtr<CFArrayRef> hostNames(AdoptCF, WKCFURLCacheCopyAllHostNamesInPersistentStore());
+#if ENABLE(CACHE_PARTITIONING)
+    RetainPtr<CFMutableArrayRef> partitions(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+    CFIndex size = CFArrayGetCount(hostNames.get());
+    for (CFIndex i = 0; i < size; ++i) {
+        RetainPtr<CFStringRef> partition = partitionName(static_cast<CFStringRef>(CFArrayGetValueAtIndex(hostNames.get(), i)));
+        RetainPtr<CFArrayRef> partitionHostNames(AdoptCF, WKCFURLCacheCopyAllHostNamesInPersistentStoreForPartition(partition.get()));
+        if (CFArrayGetCount(partitionHostNames.get()))
+            CFArrayAppendValue(partitions.get(), partition.get());
+    }
+
+    RetainPtr<CFArrayRef> rootHostNames(AdoptCF, WKCFURLCacheCopyAllHostNamesInPersistentStoreForPartition(CFSTR("")));
+    CFArrayAppendArray(partitions.get(), rootHostNames.get(), CFRangeMake(0, CFArrayGetCount(rootHostNames.get())));
+    return partitions;
+#else
+    return hostNames;
+#endif
 }
 
 void WebResourceCacheManager::clearCFURLCacheForHostNames(CFArrayRef hostNames)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to