From 21a3f60631b0d3699af2f33c7101ee4880c22eea Mon Sep 17 00:00:00 2001 From: Ilia Zaslavski Date: Fri, 31 Jan 2025 10:27:22 -0800 Subject: [PATCH] Cleanup should_remove_caller_context_from_cache_key experiment Reviewed By: amir-shalem Differential Revision: D68826878 fbshipit-source-id: 11cd305cf63535fe65db93606e2006abd3087792 --- .../cache/DefaultCacheKeyFactory.java | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/DefaultCacheKeyFactory.java b/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/DefaultCacheKeyFactory.java index 55c1003d18..bb6af5c28c 100644 --- a/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/DefaultCacheKeyFactory.java +++ b/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/DefaultCacheKeyFactory.java @@ -21,10 +21,6 @@ public class DefaultCacheKeyFactory implements CacheKeyFactory { private static @Nullable DefaultCacheKeyFactory sInstance = null; - // Experiment with removing caller context from cache key. This should prevent leaking - // the caller context object by the cache key. - private static boolean sShouldRemoveCallerContextFromCacheKey = false; - protected DefaultCacheKeyFactory() {} public static synchronized DefaultCacheKeyFactory getInstance() { @@ -34,11 +30,6 @@ public static synchronized DefaultCacheKeyFactory getInstance() { return sInstance; } - public static void setShouldRemoveCallerContextFromCacheKey( - boolean shouldRemoveCallerContextFromCacheKey) { - sShouldRemoveCallerContextFromCacheKey = shouldRemoveCallerContextFromCacheKey; - } - @Override public CacheKey getBitmapCacheKey(ImageRequest request, @Nullable Object callerContext) { BitmapMemoryCacheKey cacheKey = @@ -49,13 +40,7 @@ public CacheKey getBitmapCacheKey(ImageRequest request, @Nullable Object callerC request.getImageDecodeOptions(), null, null); - - if (sShouldRemoveCallerContextFromCacheKey) { - cacheKey.setCallerContext(null); - } else { - cacheKey.setCallerContext(callerContext); - } - + cacheKey.setCallerContext(callerContext); return cacheKey; } @@ -80,13 +65,7 @@ public CacheKey getPostprocessedBitmapCacheKey( request.getImageDecodeOptions(), postprocessorCacheKey, postprocessorName); - - if (sShouldRemoveCallerContextFromCacheKey) { - cacheKey.setCallerContext(null); - } else { - cacheKey.setCallerContext(callerContext); - } - + cacheKey.setCallerContext(callerContext); return cacheKey; }