Wrapping prefetching methods in the image pipeline inside tracing blocks
@@ -406,6 +406,11 @@ public class ImagePipeline {
public DataSource<Void> prefetchToBitmapCache(
ImageRequest imageRequest, Object callerContext, @Nullable RequestListener requestListener) {
+ try {
+ if (FrescoSystrace.isTracing()) {
+ FrescoSystrace.beginSection("ImagePipeline#prefetchToBitmapCache");
+ }
+
if (!mIsPrefetchEnabledSupplier.get()) {
return DataSources.immediateFailedDataSource(PREFETCH_EXCEPTION);
}
@@ -430,6 +435,11 @@ public class ImagePipeline {
} catch (Exception exception) {
return DataSources.immediateFailedDataSource(exception);
}
+ } finally {
+ if (FrescoSystrace.isTracing()) {
+ FrescoSystrace.endSection();
+ }
+ }
}
/**
@@ -526,6 +536,11 @@ public class ImagePipeline {
Object callerContext,
Priority priority,
@Nullable RequestListener requestListener) {
+ try {
+ if (FrescoSystrace.isTracing()) {
+ FrescoSystrace.beginSection("ImagePipeline#prefetchToEncodedCache");
+ }
+
if (!mIsPrefetchEnabledSupplier.get()) {
return DataSources.immediateFailedDataSource(PREFETCH_EXCEPTION);
}
@@ -542,6 +557,11 @@ public class ImagePipeline {
} catch (Exception exception) {
return DataSources.immediateFailedDataSource(exception);
}
+ } finally {
+ if (FrescoSystrace.isTracing()) {
+ FrescoSystrace.endSection();
+ }
+ }
}
/**
