From fd89d73be59a7aa86fddd01094bf6d72026271d4 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Thu, 13 Jun 2019 04:09:50 -0700 Subject: [PATCH] Keep track of a Throwable if custom LeakTracker is set Summary: This makes it easier to track down leaks as we currently only have their class names. There are some limitations if this is creates on a separate thread, but that can be addressed separately. This does require temporarily removing the Flipper integration as the interface changes in a backwards-incompatible manner. This will be restored with the next diff in the stack. Reviewed By: oprisnik Differential Revision: D15760947 fbshipit-source-id: 3a5c48f6244f1afc8b7e00230bd1ae2f197e6cdf --- .../plugins/fresco/FrescoFlipperPlugin.java | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/android/src/main/java/com/facebook/flipper/plugins/fresco/FrescoFlipperPlugin.java b/android/src/main/java/com/facebook/flipper/plugins/fresco/FrescoFlipperPlugin.java index 9c93a199b..27a78a03c 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/fresco/FrescoFlipperPlugin.java +++ b/android/src/main/java/com/facebook/flipper/plugins/fresco/FrescoFlipperPlugin.java @@ -13,7 +13,6 @@ import com.facebook.common.internal.Predicate; import com.facebook.common.memory.manager.DebugMemoryManager; import com.facebook.common.memory.manager.NoOpDebugMemoryManager; import com.facebook.common.references.CloseableReference; -import com.facebook.common.references.SharedReference; import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.drawee.backends.pipeline.info.ImageLoadStatus; import com.facebook.drawee.backends.pipeline.info.ImageOriginUtils; @@ -48,8 +47,7 @@ import javax.annotation.Nullable; * Allows Sonar to display the contents of Fresco's caches. This is useful for developers to debug * what images are being held in cache as they navigate through their app. */ -public class FrescoFlipperPlugin extends BufferingFlipperPlugin - implements ImagePerfDataListener, CloseableReferenceLeakTracker.Listener { +public class FrescoFlipperPlugin extends BufferingFlipperPlugin implements ImagePerfDataListener { private static final String FRESCO_EVENT = "events"; private static final String FRESCO_DEBUGOVERLAY_EVENT = "debug_overlay_event"; @@ -95,10 +93,6 @@ public class FrescoFlipperPlugin extends BufferingFlipperPlugin mMemoryManager = memoryManager; mPerfLogger = perfLogger; mDebugPrefHelper = debugPrefHelper; - - if (closeableReferenceLeakTracker != null) { - closeableReferenceLeakTracker.setListener(this); - } } public FrescoFlipperPlugin() { @@ -513,13 +507,4 @@ public class FrescoFlipperPlugin extends BufferingFlipperPlugin private static void respondError(FlipperResponder responder, String errorReason) { responder.error(new FlipperObject.Builder().put("reason", errorReason).build()); } - - @Override - public void onCloseableReferenceLeak(SharedReference reference) { - final FlipperObject.Builder builder = - new FlipperObject.Builder() - .put("identityHashCode", System.identityHashCode(reference)) - .put("className", reference.get().getClass().getName()); - send(FRESCO_CLOSEABLE_REFERENCE_LEAK_EVENT, builder.build()); - } }