discord-jadx/app/src/main/java/j0/l/a/a1.java

149 lines
5.2 KiB
Java
Raw Normal View History

2021-11-08 18:25:28 +00:00
package j0.l.a;
2021-06-27 20:44:35 +00:00
import androidx.recyclerview.widget.RecyclerView;
2021-11-08 18:25:28 +00:00
import j0.a;
import j0.l.e.c;
2021-06-27 20:44:35 +00:00
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import rx.Observable;
import rx.Subscriber;
import rx.exceptions.MissingBackpressureException;
import rx.functions.Action0;
/* compiled from: OperatorOnBackpressureBuffer */
public class a1<T> implements Observable.b<T, T> {
2021-12-21 23:37:30 +00:00
public final a.b j = a.C0321a.a;
2021-06-27 20:44:35 +00:00
/* compiled from: OperatorOnBackpressureBuffer */
public static final class a<T> extends Subscriber<T> implements c.a {
2021-12-17 22:03:14 +00:00
public final ConcurrentLinkedQueue<Object> j = new ConcurrentLinkedQueue<>();
public final AtomicLong k;
public final Subscriber<? super T> l;
public final AtomicBoolean m = new AtomicBoolean(false);
public final c n;
public final Action0 o;
public final a.b p;
2021-06-27 20:44:35 +00:00
public a(Subscriber<? super T> subscriber, Long l, Action0 action0, a.b bVar) {
2021-12-17 22:03:14 +00:00
this.l = subscriber;
this.k = null;
this.o = null;
this.n = new c(this);
this.p = bVar;
2021-06-27 20:44:35 +00:00
}
2021-11-08 18:25:28 +00:00
@Override // j0.g
2021-06-27 20:44:35 +00:00
public void onCompleted() {
2021-12-17 22:03:14 +00:00
if (!this.m.get()) {
c cVar = this.n;
2021-06-27 20:44:35 +00:00
cVar.terminated = true;
cVar.a();
}
}
2021-11-08 18:25:28 +00:00
@Override // j0.g
2021-06-27 20:44:35 +00:00
public void onError(Throwable th) {
2021-12-17 22:03:14 +00:00
if (!this.m.get()) {
c cVar = this.n;
2021-06-27 20:44:35 +00:00
if (!cVar.terminated) {
cVar.exception = th;
cVar.terminated = true;
cVar.a();
}
}
}
/* JADX WARNING: Removed duplicated region for block: B:21:0x0045 A[SYNTHETIC, Splitter:B:21:0x0045] */
/* JADX WARNING: Removed duplicated region for block: B:38:0x006b A[EDGE_INSN: B:38:0x006b->B:30:0x006b ?: BREAK , SYNTHETIC] */
2021-11-08 18:25:28 +00:00
@Override // j0.g
2021-06-27 20:44:35 +00:00
public void onNext(T t) {
boolean z2;
Action0 action0;
boolean z3 = false;
2021-12-17 22:03:14 +00:00
if (this.k != null) {
2021-06-27 20:44:35 +00:00
while (true) {
2021-12-17 22:03:14 +00:00
long j = this.k.get();
2021-06-27 20:44:35 +00:00
if (j <= 0) {
try {
2021-12-17 22:03:14 +00:00
if (this.p.a()) {
Object poll = this.j.poll();
AtomicLong atomicLong = this.k;
2021-06-27 20:44:35 +00:00
if (!(atomicLong == null || poll == null)) {
atomicLong.incrementAndGet();
}
if (poll != null) {
z2 = true;
2021-12-17 22:03:14 +00:00
action0 = this.o;
2021-06-27 20:44:35 +00:00
if (action0 != null) {
try {
action0.call();
} catch (Throwable th) {
2021-11-08 18:25:28 +00:00
h0.b.a.f.a.i(th);
2021-12-17 22:03:14 +00:00
c cVar = this.n;
2021-06-27 20:44:35 +00:00
if (!cVar.terminated) {
cVar.exception = th;
cVar.terminated = true;
cVar.a();
}
}
}
if (!z2) {
break;
}
}
}
} catch (MissingBackpressureException e) {
2021-12-17 22:03:14 +00:00
if (this.m.compareAndSet(false, true)) {
2021-06-27 20:44:35 +00:00
unsubscribe();
2021-12-17 22:03:14 +00:00
this.l.onError(e);
2021-06-27 20:44:35 +00:00
}
}
z2 = false;
2021-12-17 22:03:14 +00:00
action0 = this.o;
2021-06-27 20:44:35 +00:00
if (action0 != null) {
}
if (!z2) {
}
}
2021-12-17 22:03:14 +00:00
if (this.k.compareAndSet(j, j - 1)) {
2021-06-27 20:44:35 +00:00
break;
}
}
} else {
z3 = true;
}
if (z3) {
2021-12-17 22:03:14 +00:00
ConcurrentLinkedQueue<Object> concurrentLinkedQueue = this.j;
2021-06-27 20:44:35 +00:00
if (t == null) {
2022-01-11 22:19:46 +00:00
t = (T) e.f3731b;
2021-06-27 20:44:35 +00:00
}
concurrentLinkedQueue.offer(t);
2021-12-17 22:03:14 +00:00
this.n.a();
2021-06-27 20:44:35 +00:00
}
}
@Override // rx.Subscriber
public void onStart() {
request(RecyclerView.FOREVER_NS);
2021-06-27 20:44:35 +00:00
}
}
/* compiled from: OperatorOnBackpressureBuffer */
public static final class b {
public static final a1<?> a = new a1<>();
}
public a1() {
2021-11-08 18:25:28 +00:00
int i = j0.a.a;
2021-06-27 20:44:35 +00:00
}
2021-11-08 18:25:28 +00:00
@Override // j0.k.b
2021-06-27 20:44:35 +00:00
public Object call(Object obj) {
Subscriber subscriber = (Subscriber) obj;
2021-12-17 22:03:14 +00:00
a aVar = new a(subscriber, null, null, this.j);
2021-06-27 20:44:35 +00:00
subscriber.add(aVar);
2021-12-17 22:03:14 +00:00
subscriber.setProducer(aVar.n);
2021-06-27 20:44:35 +00:00
return aVar;
}
}