113 lines
3.7 KiB
Java
113 lines
3.7 KiB
Java
package s.a;
|
|
|
|
import c.q.a.k.a;
|
|
import d0.b;
|
|
import d0.k;
|
|
import d0.l;
|
|
import d0.z.d.m;
|
|
import java.util.concurrent.CancellationException;
|
|
import kotlin.Unit;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.coroutines.CoroutineContext;
|
|
import kotlinx.coroutines.Job;
|
|
import s.a.a.g;
|
|
import s.a.b2.h;
|
|
import s.a.b2.i;
|
|
/* compiled from: DispatchedTask.kt */
|
|
public abstract class i0<T> extends h {
|
|
public int k;
|
|
|
|
public i0(int i) {
|
|
this.k = i;
|
|
}
|
|
|
|
public void c(Object obj, Throwable th) {
|
|
}
|
|
|
|
public abstract Continuation<T> d();
|
|
|
|
public Throwable f(Object obj) {
|
|
if (!(obj instanceof v)) {
|
|
obj = null;
|
|
}
|
|
v vVar = (v) obj;
|
|
if (vVar != null) {
|
|
return vVar.b;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r1v0, resolved type: java.lang.Object */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public <T> T l(Object obj) {
|
|
return obj;
|
|
}
|
|
|
|
public final void m(Throwable th, Throwable th2) {
|
|
if (th != null || th2 != null) {
|
|
if (!(th == null || th2 == null)) {
|
|
b.addSuppressed(th, th2);
|
|
}
|
|
if (th == null) {
|
|
th = th2;
|
|
}
|
|
m.checkNotNull(th);
|
|
a.x(d().getContext(), new b0("Fatal exception in coroutines machinery for " + this + ". Please read KDoc to 'handleFatalException' method and report this incident to maintainers", th));
|
|
}
|
|
}
|
|
|
|
public abstract Object n();
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
Object obj;
|
|
Object obj2;
|
|
i iVar = this.j;
|
|
try {
|
|
Continuation<T> d = d();
|
|
if (d != null) {
|
|
g gVar = (g) d;
|
|
Continuation<T> continuation = gVar.q;
|
|
CoroutineContext context = continuation.getContext();
|
|
Object n = n();
|
|
Object b = s.a.a.a.b(context, gVar.o);
|
|
try {
|
|
Throwable f = f(n);
|
|
Job job = (f != null || !a.C(this.k)) ? null : (Job) context.get(Job.h);
|
|
if (job != null && !job.a()) {
|
|
CancellationException p = job.p();
|
|
c(n, p);
|
|
k.a aVar = k.i;
|
|
continuation.resumeWith(k.m75constructorimpl(l.createFailure(p)));
|
|
} else if (f != null) {
|
|
k.a aVar2 = k.i;
|
|
continuation.resumeWith(k.m75constructorimpl(l.createFailure(f)));
|
|
} else {
|
|
T l = l(n);
|
|
k.a aVar3 = k.i;
|
|
continuation.resumeWith(k.m75constructorimpl(l));
|
|
}
|
|
Unit unit = Unit.a;
|
|
try {
|
|
k.a aVar4 = k.i;
|
|
iVar.e();
|
|
obj2 = k.m75constructorimpl(unit);
|
|
} catch (Throwable th) {
|
|
k.a aVar5 = k.i;
|
|
obj2 = k.m75constructorimpl(l.createFailure(th));
|
|
}
|
|
m(null, k.m77exceptionOrNullimpl(obj2));
|
|
return;
|
|
} finally {
|
|
s.a.a.a.a(context, b);
|
|
}
|
|
} else {
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlinx.coroutines.internal.DispatchedContinuation<T>");
|
|
}
|
|
} catch (Throwable th2) {
|
|
k.a aVar6 = k.i;
|
|
obj = k.m75constructorimpl(l.createFailure(th2));
|
|
}
|
|
m(th, k.m77exceptionOrNullimpl(obj));
|
|
}
|
|
}
|