Upgrade to Fresco 2.0.0

Summary: Need a Fresco release including the previous diff first.

Reviewed By: danielbuechele

Differential Revision: D15762090

fbshipit-source-id: ec30778ffc1cd3e48dcfc4d514a9ba13fb26fd75
This commit is contained in:
Pascal Hartig
2019-06-13 10:15:12 -07:00
committed by Facebook Github Bot
parent eb36e667d4
commit 6168b3c604
2 changed files with 20 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ 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;
@@ -47,7 +48,8 @@ import javax.annotation.Nullable;
* 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 implements ImagePerfDataListener { public class FrescoFlipperPlugin extends BufferingFlipperPlugin
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";
@@ -93,6 +95,10 @@ public class FrescoFlipperPlugin extends BufferingFlipperPlugin implements Image
mMemoryManager = memoryManager; mMemoryManager = memoryManager;
mPerfLogger = perfLogger; mPerfLogger = perfLogger;
mDebugPrefHelper = debugPrefHelper; mDebugPrefHelper = debugPrefHelper;
if (closeableReferenceLeakTracker != null) {
closeableReferenceLeakTracker.setListener(this);
}
} }
public FrescoFlipperPlugin() { public FrescoFlipperPlugin() {
@@ -507,4 +513,14 @@ public class FrescoFlipperPlugin extends BufferingFlipperPlugin implements Image
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<Object> reference, @Nullable Throwable stacktrace) {
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());
}
} }

View File

@@ -89,7 +89,7 @@ ext.deps = [
testCore : 'androidx.test:core:1.1.0', testCore : 'androidx.test:core:1.1.0',
testRules : 'androidx.test:rules:1.1.0', testRules : 'androidx.test:rules:1.1.0',
// Plugin dependencies // Plugin dependencies
frescoFlipper : 'com.facebook.fresco:flipper:1.14.2', frescoFlipper : 'com.facebook.fresco:flipper:2.0.0',
frescoStetho : 'com.facebook.fresco:stetho:1.14.2', frescoStetho : 'com.facebook.fresco:stetho:2.0.0',
fresco : 'com.facebook.fresco:fresco:1.14.2' fresco : 'com.facebook.fresco:fresco:2.0.0'
] ]