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

131 lines
3.7 KiB
Java

package j0.l.a;
import j0.l.a.q0;
import rx.Scheduler;
import rx.Subscriber;
import rx.functions.Action0;
import rx.observers.SerializedSubscriber;
import rx.subscriptions.SerialSubscription;
/* compiled from: OperatorDebounceWithTime */
public class p0 extends Subscriber<T> {
public final q0.a<T> i = new q0.a<>();
public final Subscriber<?> j = this;
public final /* synthetic */ SerialSubscription k;
public final /* synthetic */ Scheduler.Worker l;
public final /* synthetic */ SerializedSubscriber m;
public final /* synthetic */ q0 n;
/* compiled from: OperatorDebounceWithTime */
public class a implements Action0 {
public final /* synthetic */ int i;
public a(int i) {
this.i = i;
}
@Override // rx.functions.Action0
public void call() {
T t;
p0 p0Var = p0.this;
q0.a<T> aVar = p0Var.i;
int i = this.i;
SerializedSubscriber serializedSubscriber = p0Var.m;
Subscriber<?> subscriber = p0Var.j;
synchronized (aVar) {
if (!aVar.e && aVar.f2836c) {
if (i == aVar.a) {
t = aVar.b;
aVar.b = null;
aVar.f2836c = false;
aVar.e = true;
}
}
return;
}
try {
serializedSubscriber.onNext(t);
synchronized (aVar) {
if (!aVar.d) {
aVar.e = false;
} else {
serializedSubscriber.onCompleted();
}
}
} catch (Throwable th) {
c.q.a.k.a.b0(th, subscriber, t);
}
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public p0(q0 q0Var, Subscriber subscriber, SerialSubscription serialSubscription, Scheduler.Worker worker, SerializedSubscriber serializedSubscriber) {
super(subscriber);
this.n = q0Var;
this.k = serialSubscription;
this.l = worker;
this.m = serializedSubscriber;
}
@Override // j0.g
public void onCompleted() {
T t;
boolean z2;
q0.a<T> aVar = this.i;
SerializedSubscriber serializedSubscriber = this.m;
synchronized (aVar) {
if (aVar.e) {
aVar.d = true;
return;
}
t = aVar.b;
z2 = aVar.f2836c;
aVar.b = null;
aVar.f2836c = false;
aVar.e = true;
}
if (z2) {
try {
serializedSubscriber.onNext(t);
} catch (Throwable th) {
c.q.a.k.a.b0(th, this, t);
return;
}
}
serializedSubscriber.onCompleted();
}
@Override // j0.g
public void onError(Throwable th) {
this.m.i.onError(th);
unsubscribe();
q0.a<T> aVar = this.i;
synchronized (aVar) {
aVar.a++;
aVar.b = null;
aVar.f2836c = false;
}
}
@Override // j0.g
public void onNext(T t) {
int i;
q0.a<T> aVar = this.i;
synchronized (aVar) {
aVar.b = t;
aVar.f2836c = true;
i = aVar.a + 1;
aVar.a = i;
}
SerialSubscription serialSubscription = this.k;
Scheduler.Worker worker = this.l;
a aVar2 = new a(i);
q0 q0Var = this.n;
serialSubscription.a(worker.b(aVar2, q0Var.i, q0Var.j));
}
@Override // rx.Subscriber
public void onStart() {
request(Long.MAX_VALUE);
}
}