Added Systrace marker for ThreadHandoffProducer
package com.facebook.imagepipeline.producers;
import com.facebook.common.internal.Preconditions;
+import com.facebook.imagepipeline.systrace.FrescoSystrace;
import javax.annotation.Nullable;
/** Uses ExecutorService to move further computation to different thread */
@@ -27,6 +28,10 @@ public class ThreadHandoffProducer<T> implements Producer<T> {
@Override
public void produceResults(final Consumer<T> consumer, final ProducerContext context) {
+ try {
+ if (FrescoSystrace.isTracing()) {
+ FrescoSystrace.beginSection("ThreadHandoffProducer#produceResults");
+ }
final ProducerListener2 producerListener = context.getProducerListener();
final StatefulProducerRunnable<T> statefulRunnable =
new StatefulProducerRunnable<T>(consumer, producerListener, context, PRODUCER_NAME) {
@@ -53,5 +58,10 @@ public class ThreadHandoffProducer<T> implements Producer<T> {
}
});
mThreadHandoffProducerQueue.addToQueueOrExecute(statefulRunnable);
+ } finally {
+ if (FrescoSystrace.isTracing()) {
+ FrescoSystrace.endSection();
+ }
+ }
}
}
