213 lines
6.7 KiB
Java
213 lines
6.7 KiB
Java
package o;
|
|
|
|
import android.R;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
/* renamed from: o.fWC, reason: case insensitive filesystem */
|
|
/* loaded from: classes6.dex */
|
|
public final class C13284fWC<T> extends fUX<T, T> {
|
|
private InterfaceC13160fSh<? extends T> d;
|
|
|
|
public C13284fWC(AbstractC13163fSk<T> abstractC13163fSk, InterfaceC13160fSh<? extends T> interfaceC13160fSh) {
|
|
super(abstractC13163fSk);
|
|
this.d = interfaceC13160fSh;
|
|
}
|
|
|
|
@Override // o.AbstractC13163fSk
|
|
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
|
|
HBt hBt = new HBt(interfaceC13174fSv);
|
|
interfaceC13174fSv.onSubscribe(hBt);
|
|
this.c.subscribe(hBt);
|
|
this.d.c(hBt.a);
|
|
}
|
|
|
|
/* renamed from: o.fWC$HBt */
|
|
/* loaded from: classes6.dex */
|
|
static final class HBt<T> extends AtomicInteger implements InterfaceC13174fSv<T>, fSJ {
|
|
volatile int d;
|
|
final InterfaceC13174fSv<? super T> e;
|
|
private volatile boolean f;
|
|
private volatile boolean h;
|
|
private volatile InterfaceC13408fZk<T> i;
|
|
T j;
|
|
final AtomicReference<fSJ> b = new AtomicReference<>();
|
|
final LWm<T> a = new LWm<>(this);
|
|
final C13355fYI c = new C13355fYI();
|
|
|
|
HBt(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
|
|
this.e = interfaceC13174fSv;
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onSubscribe(fSJ fsj) {
|
|
EnumC13192fTf.a(this.b, fsj);
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onNext(T t) {
|
|
if (compareAndSet(0, 1)) {
|
|
this.e.onNext(t);
|
|
if (decrementAndGet() == 0) {
|
|
return;
|
|
}
|
|
} else {
|
|
C13416fZs c13416fZs = this.i;
|
|
if (c13416fZs == null) {
|
|
c13416fZs = new C13416fZs(AbstractC13163fSk.bufferSize());
|
|
this.i = c13416fZs;
|
|
}
|
|
c13416fZs.b(t);
|
|
if (getAndIncrement() != 0) {
|
|
return;
|
|
}
|
|
}
|
|
b();
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final boolean isDisposed() {
|
|
return EnumC13192fTf.c(this.b.get());
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final void dispose() {
|
|
this.h = true;
|
|
EnumC13192fTf.e(this.b);
|
|
EnumC13192fTf.e(this.a);
|
|
Throwable b = fYR.b(this.c);
|
|
if (b != null && b != fYR.b) {
|
|
C13418fZu.c(b);
|
|
}
|
|
if (getAndIncrement() == 0) {
|
|
this.i = null;
|
|
this.j = null;
|
|
}
|
|
}
|
|
|
|
final void b() {
|
|
InterfaceC13174fSv<? super T> interfaceC13174fSv = this.e;
|
|
int i = 1;
|
|
while (!this.h) {
|
|
if (this.c.get() == null) {
|
|
int i2 = this.d;
|
|
if (i2 == 1) {
|
|
T t = this.j;
|
|
this.j = null;
|
|
this.d = 2;
|
|
interfaceC13174fSv.onNext(t);
|
|
i2 = 2;
|
|
}
|
|
boolean z = this.f;
|
|
InterfaceC13408fZk<T> interfaceC13408fZk = this.i;
|
|
R.color b = interfaceC13408fZk != null ? interfaceC13408fZk.b() : null;
|
|
boolean z2 = b == null;
|
|
if (z && z2 && i2 == 2) {
|
|
this.i = null;
|
|
interfaceC13174fSv.onComplete();
|
|
return;
|
|
} else if (!z2) {
|
|
interfaceC13174fSv.onNext(b);
|
|
} else {
|
|
i = addAndGet(-i);
|
|
if (i == 0) {
|
|
return;
|
|
}
|
|
}
|
|
} else {
|
|
this.j = null;
|
|
this.i = null;
|
|
Throwable b2 = fYR.b(this.c);
|
|
if (b2 == null) {
|
|
interfaceC13174fSv.onComplete();
|
|
return;
|
|
} else {
|
|
if (b2 != fYR.b) {
|
|
interfaceC13174fSv.onError(b2);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
this.j = null;
|
|
this.i = null;
|
|
}
|
|
|
|
/* renamed from: o.fWC$HBt$LWm */
|
|
/* loaded from: classes6.dex */
|
|
static final class LWm<T> extends AtomicReference<fSJ> implements InterfaceC13161fSi<T> {
|
|
private HBt<T> a;
|
|
|
|
LWm(HBt<T> hBt) {
|
|
this.a = hBt;
|
|
}
|
|
|
|
@Override // o.InterfaceC13161fSi
|
|
public final void onSubscribe(fSJ fsj) {
|
|
EnumC13192fTf.a(this, fsj);
|
|
}
|
|
|
|
@Override // o.InterfaceC13161fSi
|
|
public final void onError(Throwable th) {
|
|
HBt<T> hBt = this.a;
|
|
if (fYR.c(hBt.c, th)) {
|
|
EnumC13192fTf.e(hBt.b);
|
|
if (hBt.getAndIncrement() == 0) {
|
|
hBt.b();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
C13418fZu.c(th);
|
|
}
|
|
|
|
@Override // o.InterfaceC13161fSi
|
|
public final void onComplete() {
|
|
HBt<T> hBt = this.a;
|
|
hBt.d = 2;
|
|
if (hBt.getAndIncrement() == 0) {
|
|
hBt.b();
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC13161fSi
|
|
public final void e(T t) {
|
|
HBt<T> hBt = this.a;
|
|
if (hBt.compareAndSet(0, 1)) {
|
|
hBt.e.onNext(t);
|
|
hBt.d = 2;
|
|
} else {
|
|
hBt.j = t;
|
|
hBt.d = 1;
|
|
if (hBt.getAndIncrement() != 0) {
|
|
return;
|
|
}
|
|
}
|
|
hBt.b();
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onComplete() {
|
|
this.f = true;
|
|
if (getAndIncrement() == 0) {
|
|
b();
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onError(Throwable th) {
|
|
if (fYR.c(this.c, th)) {
|
|
EnumC13192fTf.e(this.a);
|
|
if (getAndIncrement() == 0) {
|
|
b();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
C13418fZu.c(th);
|
|
}
|
|
}
|
|
}
|