Pipeline systrace - add markers to DecodeProducer
@@ -31,6 +31,7 @@ import com.facebook.imagepipeline.image.EncodedImage;
import com.facebook.imagepipeline.image.ImmutableQualityInfo;
import com.facebook.imagepipeline.image.QualityInfo;
import com.facebook.imagepipeline.request.ImageRequest;
+import com.facebook.imagepipeline.systrace.FrescoSystrace;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;
@@ -90,6 +91,8 @@ public class DecodeProducer implements Producer<CloseableReference<CloseableImag
public void produceResults(
final Consumer<CloseableReference<CloseableImage>> consumer,
final ProducerContext producerContext) {
+ try {
+ FrescoSystrace.beginSection("DecodeProducer#produceResults");
final ImageRequest imageRequest = producerContext.getImageRequest();
ProgressiveDecoder progressiveDecoder;
if (!UriUtil.isNetworkUri(imageRequest.getSourceUri())) {
@@ -108,6 +111,9 @@ public class DecodeProducer implements Producer<CloseableReference<CloseableImag
mMaxBitmapSize);
}
mInputProducer.produceResults(progressiveDecoder, producerContext);
+ } finally {
+ FrescoSystrace.endSection();
+ }
}
private abstract class ProgressiveDecoder extends DelegatingConsumer<
@@ -173,6 +179,8 @@ public class DecodeProducer implements Producer<CloseableReference<CloseableImag
@Override
public void onNewResultImpl(EncodedImage newResult, @Status int status) {
+ try {
+ FrescoSystrace.beginSection("DecodeProducer#onNewResultImpl");
final boolean isLast = isLast(status);
if (isLast && !EncodedImage.isValid(newResult)) {
handleError(new ExceptionWithNoStacktrace("Encoded image is not valid."));
@@ -185,6 +193,9 @@ public class DecodeProducer implements Producer<CloseableReference<CloseableImag
if (isLast || isPlaceholder || mProducerContext.isIntermediateResultExpected()) {
mJobScheduler.scheduleJob();
}
+ } finally {
+ FrescoSystrace.endSection();
+ }
}
@Override
