Temporarily remove FlipperCloseableReferenceLeakTracker

Summary:
Ugh, this is the only way we can land the API-breaking next diff. Will
be reverted straight after.

Reviewed By: oprisnik

Differential Revision: D15655666

fbshipit-source-id: c9318e348c187de4562a9a636287cfa7b523356f
This commit is contained in:
Pascal Hartig
2019-06-06 04:50:34 -07:00
committed by Facebook Github Bot
parent 8b7f17d932
commit dc41e2d778

View File

@@ -13,7 +13,6 @@ import com.facebook.common.internal.Predicate;
import com.facebook.common.memory.manager.DebugMemoryManager; import com.facebook.common.memory.manager.DebugMemoryManager;
import com.facebook.common.memory.manager.NoOpDebugMemoryManager; import com.facebook.common.memory.manager.NoOpDebugMemoryManager;
import com.facebook.common.references.CloseableReference; 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.Fresco;
import com.facebook.drawee.backends.pipeline.info.ImageLoadStatus; import com.facebook.drawee.backends.pipeline.info.ImageLoadStatus;
import com.facebook.drawee.backends.pipeline.info.ImageOriginUtils; import com.facebook.drawee.backends.pipeline.info.ImageOriginUtils;
@@ -38,25 +37,20 @@ import com.facebook.imagepipeline.debug.FlipperImageTracker;
import com.facebook.imagepipeline.image.CloseableBitmap; import com.facebook.imagepipeline.image.CloseableBitmap;
import com.facebook.imagepipeline.image.CloseableImage; import com.facebook.imagepipeline.image.CloseableImage;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.json.JSONArray;
/** /**
* Allows Sonar to display the contents of Fresco's caches. This is useful for developers to debug * 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. * what images are being held in cache as they navigate through their app.
*/ */
public class FrescoFlipperPlugin extends BufferingFlipperPlugin public class FrescoFlipperPlugin extends BufferingFlipperPlugin implements ImagePerfDataListener {
implements ImagePerfDataListener, CloseableReferenceLeakTracker.Listener {
private static final String FRESCO_EVENT = "events"; private static final String FRESCO_EVENT = "events";
private static final String FRESCO_DEBUGOVERLAY_EVENT = "debug_overlay_event"; private static final String FRESCO_DEBUGOVERLAY_EVENT = "debug_overlay_event";
private static final String FRESCO_CLOSEABLE_REFERENCE_LEAK_EVENT =
"closeable_reference_leak_event";
private static final int BITMAP_PREVIEW_WIDTH = 150; private static final int BITMAP_PREVIEW_WIDTH = 150;
private static final int BITMAP_PREVIEW_HEIGHT = 150; private static final int BITMAP_PREVIEW_HEIGHT = 150;
@@ -97,10 +91,6 @@ public class FrescoFlipperPlugin extends BufferingFlipperPlugin
mMemoryManager = memoryManager; mMemoryManager = memoryManager;
mPerfLogger = perfLogger; mPerfLogger = perfLogger;
mDebugPrefHelper = debugPrefHelper; mDebugPrefHelper = debugPrefHelper;
if (closeableReferenceLeakTracker != null) {
closeableReferenceLeakTracker.setListener(this);
}
} }
public FrescoFlipperPlugin() { public FrescoFlipperPlugin() {
@@ -515,13 +505,4 @@ public class FrescoFlipperPlugin extends BufferingFlipperPlugin
private static void respondError(FlipperResponder responder, String errorReason) { private static void respondError(FlipperResponder responder, String errorReason) {
responder.error(new FlipperObject.Builder().put("reason", errorReason).build()); responder.error(new FlipperObject.Builder().put("reason", errorReason).build());
} }
@Override
public void onCloseableReferenceLeak(SharedReference<Closeable> 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());
}
} }