Title: [249498] trunk/Source
Revision
249498
Author
achristen...@apple.com
Date
2019-09-04 14:11:04 -0700 (Wed, 04 Sep 2019)

Log Message

Remove unused SPI that accesses MemoryCache directly
https://bugs.webkit.org/show_bug.cgi?id=201468

Reviewed by Tim Horton.

Source/WebCore:

* loader/cache/MemoryCache.cpp:
(WebCore::dummyCachedImageClient): Deleted.
(WebCore::MemoryCache::addImageToCache): Deleted.
(WebCore::MemoryCache::removeImageFromCache): Deleted.
* loader/cache/MemoryCache.h:

Source/WebKitLegacy/mac:

* Misc/WebCache.h:
* Misc/WebCache.mm:
(+[WebCache addImageToCache:forURL:]): Deleted.
(+[WebCache addImageToCache:forURL:forFrame:]): Deleted.
(+[WebCache removeImageFromCacheForURL:]): Deleted.
(+[WebCache removeImageFromCacheForURL:forFrame:]): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (249497 => 249498)


--- trunk/Source/WebCore/ChangeLog	2019-09-04 20:42:08 UTC (rev 249497)
+++ trunk/Source/WebCore/ChangeLog	2019-09-04 21:11:04 UTC (rev 249498)
@@ -1,3 +1,16 @@
+2019-09-04  Alex Christensen  <achristen...@webkit.org>
+
+        Remove unused SPI that accesses MemoryCache directly
+        https://bugs.webkit.org/show_bug.cgi?id=201468
+
+        Reviewed by Tim Horton.
+
+        * loader/cache/MemoryCache.cpp:
+        (WebCore::dummyCachedImageClient): Deleted.
+        (WebCore::MemoryCache::addImageToCache): Deleted.
+        (WebCore::MemoryCache::removeImageFromCache): Deleted.
+        * loader/cache/MemoryCache.h:
+
 2019-09-04  Zalan Bujtas  <za...@apple.com>
 
         [LFC] Assert on FormattingContext escaping

Modified: trunk/Source/WebCore/loader/cache/MemoryCache.cpp (249497 => 249498)


--- trunk/Source/WebCore/loader/cache/MemoryCache.cpp	2019-09-04 20:42:08 UTC (rev 249497)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.cpp	2019-09-04 21:11:04 UTC (rev 249498)
@@ -204,52 +204,6 @@
     return m_capacity - deadCapacity();
 }
 
-static CachedImageClient& dummyCachedImageClient()
-{
-    static NeverDestroyed<CachedImageClient> client;
-    return client;
-}
-
-bool MemoryCache::addImageToCache(NativeImagePtr&& image, const URL& url, const String& domainForCachePartition, const PAL::SessionID& sessionID, const CookieJar* cookieJar)
-{
-    ASSERT(image);
-    removeImageFromCache(url, domainForCachePartition); // Remove cache entry if it already exists.
-
-    auto bitmapImage = BitmapImage::create(WTFMove(image), nullptr);
-    auto cachedImage = makeUnique<CachedImage>(url, bitmapImage.ptr(), sessionID, cookieJar, domainForCachePartition);
-
-    cachedImage->addClient(dummyCachedImageClient());
-    cachedImage->setDecodedSize(bitmapImage->decodedSize());
-
-    return add(*cachedImage.release());
-}
-
-void MemoryCache::removeImageFromCache(const URL& url, const String& domainForCachePartition)
-{
-    auto* resources = sessionResourceMap(PAL::SessionID::defaultSessionID());
-    if (!resources)
-        return;
-
-    auto key = std::make_pair(url, ResourceRequest::partitionName(domainForCachePartition));
-
-    CachedResource* resource = resources->get(key);
-    if (!resource)
-        return;
-
-    // A resource exists and is not a manually cached image, so just remove it.
-    if (!is<CachedImage>(*resource) || !downcast<CachedImage>(*resource).isManuallyCached()) {
-        remove(*resource);
-        return;
-    }
-
-    // Removing the last client of a CachedImage turns the resource
-    // into a dead resource which will eventually be evicted when
-    // dead resources are pruned. That might be immediately since
-    // removing the last client triggers a MemoryCache::prune, so the
-    // resource may be deleted after this call.
-    downcast<CachedImage>(*resource).removeClient(dummyCachedImageClient());
-}
-
 void MemoryCache::pruneLiveResources(bool shouldDestroyDecodedDataForAllLiveResources)
 {
     unsigned capacity = shouldDestroyDecodedDataForAllLiveResources ? 0 : liveCapacity();

Modified: trunk/Source/WebCore/loader/cache/MemoryCache.h (249497 => 249498)


--- trunk/Source/WebCore/loader/cache/MemoryCache.h	2019-09-04 20:42:08 UTC (rev 249497)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.h	2019-09-04 21:11:04 UTC (rev 249498)
@@ -157,9 +157,6 @@
     WEBCORE_EXPORT void getOriginsWithCache(SecurityOriginSet& origins);
     WEBCORE_EXPORT HashSet<RefPtr<SecurityOrigin>> originsWithCache(PAL::SessionID) const;
 
-    WEBCORE_EXPORT bool addImageToCache(NativeImagePtr&&, const URL&, const String& domainForCachePartition, const PAL::SessionID&, const CookieJar*);
-    WEBCORE_EXPORT void removeImageFromCache(const URL&, const String& domainForCachePartition);
-
     // pruneDead*() - Flush decoded and encoded data from resources not referenced by Web pages.
     // pruneLive*() - Flush decoded data from resources still referenced by Web pages.
     WEBCORE_EXPORT void pruneDeadResources(); // Automatically decide how much to prune.

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (249497 => 249498)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2019-09-04 20:42:08 UTC (rev 249497)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2019-09-04 21:11:04 UTC (rev 249498)
@@ -1,3 +1,17 @@
+2019-09-04  Alex Christensen  <achristen...@webkit.org>
+
+        Remove unused SPI that accesses MemoryCache directly
+        https://bugs.webkit.org/show_bug.cgi?id=201468
+
+        Reviewed by Tim Horton.
+
+        * Misc/WebCache.h:
+        * Misc/WebCache.mm:
+        (+[WebCache addImageToCache:forURL:]): Deleted.
+        (+[WebCache addImageToCache:forURL:forFrame:]): Deleted.
+        (+[WebCache removeImageFromCacheForURL:]): Deleted.
+        (+[WebCache removeImageFromCacheForURL:forFrame:]): Deleted.
+
 2019-08-30  Keith Rollin  <krol...@apple.com>
 
         Remove AppKitCompatibilityDeclarations.h

Modified: trunk/Source/WebKitLegacy/mac/Misc/WebCache.h (249497 => 249498)


--- trunk/Source/WebKitLegacy/mac/Misc/WebCache.h	2019-09-04 20:42:08 UTC (rev 249497)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebCache.h	2019-09-04 21:11:04 UTC (rev 249498)
@@ -36,11 +36,6 @@
 #if TARGET_OS_IPHONE
 + (void)emptyInMemoryResources;
 + (void)sizeOfDeadResources:(int *)resources;
-// SPI to add a CGImageRef directly to the WebCore cache.
-+ (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url;
-+ (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url forFrame:(WebFrame *)frame;
-+ (void)removeImageFromCacheForURL:(NSURL *)url;
-+ (void)removeImageFromCacheForURL:(NSURL *)url forFrame:(WebFrame *)frame;
 + (CGImageRef)imageForURL:(NSURL *)url;
 #endif
 + (void)setDisabled:(BOOL)disabled;

Modified: trunk/Source/WebKitLegacy/mac/Misc/WebCache.mm (249497 => 249498)


--- trunk/Source/WebKitLegacy/mac/Misc/WebCache.mm	2019-09-04 20:42:08 UTC (rev 249497)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebCache.mm	2019-09-04 21:11:04 UTC (rev 249498)
@@ -164,33 +164,6 @@
     }
 }
 
-+ (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url
-{
-    return [WebCache addImageToCache:image forURL:url forFrame:nil];
-}
-
-+ (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url forFrame:(WebFrame *)frame
-{
-    if (!image || !url || ![[url absoluteString] length])
-        return false;
-
-    auto provider = adoptRef(*new DefaultStorageSessionProvider);
-    return WebCore::MemoryCache::singleton().addImageToCache(RetainPtr<CGImageRef>(image), url, frame ? core(frame)->document()->domainForCachePartition() : emptyString(), PAL::SessionID::defaultSessionID(), WebCore::CookieJar::create(WTFMove(provider)).ptr());
-}
-
-+ (void)removeImageFromCacheForURL:(NSURL *)url
-{
-    [WebCache removeImageFromCacheForURL:url forFrame:nil];
-}
-
-+ (void)removeImageFromCacheForURL:(NSURL *)url forFrame:(WebFrame *)frame
-{
-    if (!url)
-        return;
-
-    return WebCore::MemoryCache::singleton().removeImageFromCache(url, frame ? core(frame)->document()->domainForCachePartition() : emptyString());
-}
-
 + (CGImageRef)imageForURL:(NSURL *)url
 {
     if (!url)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to