discord-jadx/app/src/main/java/androidx/lifecycle/BlockRunner.java

86 lines
3.4 KiB
Java
Raw Normal View History

2021-07-24 02:37:17 +00:00
package androidx.lifecycle;
import androidx.annotation.MainThread;
2021-12-17 22:01:24 +00:00
import b.i.a.f.e.o.f;
2021-11-01 07:19:03 +00:00
import d0.z.d.m;
2021-07-24 02:37:17 +00:00
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Job;
2021-11-01 07:19:03 +00:00
import s.a.a.n;
2021-12-17 22:01:24 +00:00
import s.a.k0;
2021-07-24 02:37:17 +00:00
/* 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;
2021-12-17 22:01:24 +00:00
CoroutineDispatcher coroutineDispatcher = k0.a;
2022-01-27 08:54:45 +00:00
this.cancellationJob = f.H0(coroutineScope, n.f3798b.H(), null, new BlockRunner$cancel$1(this, null), 2, null);
2021-07-24 02:37:17 +00:00
return;
}
throw new IllegalStateException("Cancel call cannot happen without a maybeRun".toString());
}
@MainThread
public final void maybeRun() {
Job job = this.cancellationJob;
if (job != null) {
2022-01-17 16:29:36 +00:00
f.t(job, null, 1, null);
2021-07-24 02:37:17 +00:00
}
this.cancellationJob = null;
if (this.runningJob == null) {
2022-01-17 16:29:36 +00:00
this.runningJob = f.H0(this.scope, null, null, new BlockRunner$maybeRun$1(this, null), 3, null);
2021-07-24 02:37:17 +00:00
}
}
}