84 lines
3.3 KiB
Java
84 lines
3.3 KiB
Java
package androidx.lifecycle;
|
|
|
|
import androidx.annotation.MainThread;
|
|
import c.q.a.k.a;
|
|
import d0.z.d.m;
|
|
import kotlin.Unit;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlinx.coroutines.CoroutineScope;
|
|
import kotlinx.coroutines.Job;
|
|
import s.a.j0;
|
|
import s.a.z;
|
|
/* compiled from: CoroutineLiveData.kt */
|
|
public final class BlockRunner<T> {
|
|
private final Function2<LiveDataScope<T>, Continuation<? super Unit>, Object> block;
|
|
private Job cancellationJob;
|
|
private final CoroutineLiveData<T> liveData;
|
|
private final Function0<Unit> onDone;
|
|
private Job runningJob;
|
|
private final CoroutineScope scope;
|
|
private final long timeoutInMs;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: kotlin.jvm.functions.Function2<? super androidx.lifecycle.LiveDataScope<T>, ? super kotlin.coroutines.Continuation<? super kotlin.Unit>, ? extends java.lang.Object> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public BlockRunner(CoroutineLiveData<T> coroutineLiveData, Function2<? super LiveDataScope<T>, ? super Continuation<? super Unit>, ? extends Object> function2, long j, CoroutineScope coroutineScope, Function0<Unit> function0) {
|
|
m.checkNotNullParameter(coroutineLiveData, "liveData");
|
|
m.checkNotNullParameter(function2, "block");
|
|
m.checkNotNullParameter(coroutineScope, "scope");
|
|
m.checkNotNullParameter(function0, "onDone");
|
|
this.liveData = coroutineLiveData;
|
|
this.block = function2;
|
|
this.timeoutInMs = j;
|
|
this.scope = coroutineScope;
|
|
this.onDone = function0;
|
|
}
|
|
|
|
public static final /* synthetic */ Function2 access$getBlock$p(BlockRunner blockRunner) {
|
|
return blockRunner.block;
|
|
}
|
|
|
|
public static final /* synthetic */ CoroutineLiveData access$getLiveData$p(BlockRunner blockRunner) {
|
|
return blockRunner.liveData;
|
|
}
|
|
|
|
public static final /* synthetic */ Function0 access$getOnDone$p(BlockRunner blockRunner) {
|
|
return blockRunner.onDone;
|
|
}
|
|
|
|
public static final /* synthetic */ Job access$getRunningJob$p(BlockRunner blockRunner) {
|
|
return blockRunner.runningJob;
|
|
}
|
|
|
|
public static final /* synthetic */ long access$getTimeoutInMs$p(BlockRunner blockRunner) {
|
|
return blockRunner.timeoutInMs;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setRunningJob$p(BlockRunner blockRunner, Job job) {
|
|
blockRunner.runningJob = job;
|
|
}
|
|
|
|
@MainThread
|
|
public final void cancel() {
|
|
if (this.cancellationJob == null) {
|
|
CoroutineScope coroutineScope = this.scope;
|
|
z zVar = j0.a;
|
|
this.cancellationJob = a.F(coroutineScope, s.a.a.m.b.H(), null, new BlockRunner$cancel$1(this, null), 2, null);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Cancel call cannot happen without a maybeRun".toString());
|
|
}
|
|
|
|
@MainThread
|
|
public final void maybeRun() {
|
|
Job job = this.cancellationJob;
|
|
if (job != null) {
|
|
a.j(job, null, 1, null);
|
|
}
|
|
this.cancellationJob = null;
|
|
if (this.runningJob == null) {
|
|
this.runningJob = a.F(this.scope, null, null, new BlockRunner$maybeRun$1(this, null), 3, null);
|
|
}
|
|
}
|
|
}
|