Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
package io.reactivex.internal.util;
import io.reactivex.functions.Predicate;
/* loaded from: classes2.dex */
public class AppendOnlyLinkedArrayList<T> {
final int a;
final Object[] b;
Object[] c;
int d;
public interface NonThrowingPredicate<T> extends Predicate<T> {
@Override // io.reactivex.functions.Predicate
boolean a(T t);
}
public AppendOnlyLinkedArrayList(int i) {
this.a = i;
this.b = new Object[i + 1];
this.c = this.b;
}
public void a(T t) {
int i = this.a;
int i2 = this.d;
if (i2 == i) {
Object[] objArr = new Object[i + 1];
this.c[i] = objArr;
this.c = objArr;
i2 = 0;
}
this.c[i2] = t;
this.d = i2 + 1;
}
public void b(T t) {
this.b[0] = t;
}
/* JADX WARN: Code restructure failed: missing block: B:13:0x0018, code lost:
continue;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void a(io.reactivex.internal.util.AppendOnlyLinkedArrayList.NonThrowingPredicate<? super T> r5) {
/*
r4 = this;
java.lang.Object[] r0 = r4.b
int r1 = r4.a
L4:
if (r0 == 0) goto L1d
r2 = 0
L7:
if (r2 >= r1) goto L18
r3 = r0[r2]
if (r3 != 0) goto Le
goto L18
Le:
boolean r3 = r5.a(r3)
if (r3 == 0) goto L15
return
L15:
int r2 = r2 + 1
goto L7
L18:
r0 = r0[r1]
java.lang.Object[] r0 = (java.lang.Object[]) r0
goto L4
L1d:
return
*/
throw new UnsupportedOperationException("Method not decompiled: io.reactivex.internal.util.AppendOnlyLinkedArrayList.a(io.reactivex.internal.util.AppendOnlyLinkedArrayList$NonThrowingPredicate):void");
}
/* JADX WARN: Code restructure failed: missing block: B:13:0x0019, code lost:
continue;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public <U> boolean a(io.reactivex.Observer<? super U> r5) {
/*
r4 = this;
java.lang.Object[] r0 = r4.b
int r1 = r4.a
L4:
r2 = 0
if (r0 == 0) goto L1e
L7:
if (r2 >= r1) goto L19
r3 = r0[r2]
if (r3 != 0) goto Le
goto L19
Le:
boolean r3 = io.reactivex.internal.util.NotificationLite.acceptFull(r3, r5)
if (r3 == 0) goto L16
r5 = 1
return r5
L16:
int r2 = r2 + 1
goto L7
L19:
r0 = r0[r1]
java.lang.Object[] r0 = (java.lang.Object[]) r0
goto L4
L1e:
return r2
*/
throw new UnsupportedOperationException("Method not decompiled: io.reactivex.internal.util.AppendOnlyLinkedArrayList.a(io.reactivex.Observer):boolean");
}
}

View File

@@ -0,0 +1,29 @@
package io.reactivex.internal.util;
import io.reactivex.functions.Function;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
/* loaded from: classes2.dex */
public enum ArrayListSupplier implements Callable<List<Object>>, Function<Object, List<Object>> {
INSTANCE;
public static <T> Callable<List<T>> asCallable() {
return INSTANCE;
}
public static <T, O> Function<O, List<T>> asFunction() {
return INSTANCE;
}
@Override // io.reactivex.functions.Function
public List<Object> apply(Object obj) throws Exception {
return new ArrayList();
}
@Override // java.util.concurrent.Callable
public List<Object> call() throws Exception {
return new ArrayList();
}
}

View File

@@ -0,0 +1,20 @@
package io.reactivex.internal.util;
import java.util.concurrent.atomic.AtomicReference;
/* loaded from: classes2.dex */
public final class AtomicThrowable extends AtomicReference<Throwable> {
private static final long serialVersionUID = 3949248817947090603L;
public boolean addThrowable(Throwable th) {
return ExceptionHelper.a(this, th);
}
public boolean isTerminated() {
return get() == ExceptionHelper.a;
}
public Throwable terminate() {
return ExceptionHelper.a(this);
}
}

View File

@@ -0,0 +1,43 @@
package io.reactivex.internal.util;
import io.reactivex.plugins.RxJavaPlugins;
import java.util.concurrent.atomic.AtomicLong;
/* loaded from: classes2.dex */
public final class BackpressureHelper {
public static long a(long j, long j2) {
long j3 = j + j2;
if (j3 < 0) {
return Long.MAX_VALUE;
}
return j3;
}
public static long a(AtomicLong atomicLong, long j) {
long j2;
do {
j2 = atomicLong.get();
if (j2 == Long.MAX_VALUE) {
return Long.MAX_VALUE;
}
} while (!atomicLong.compareAndSet(j2, a(j2, j)));
return j2;
}
public static long b(AtomicLong atomicLong, long j) {
long j2;
long j3;
do {
j2 = atomicLong.get();
if (j2 == Long.MAX_VALUE) {
return Long.MAX_VALUE;
}
j3 = j2 - j;
if (j3 < 0) {
RxJavaPlugins.b(new IllegalStateException("More produced than requested: " + j3));
j3 = 0L;
}
} while (!atomicLong.compareAndSet(j2, j3));
return j3;
}
}

View File

@@ -0,0 +1,31 @@
package io.reactivex.internal.util;
import io.reactivex.disposables.Disposable;
import io.reactivex.internal.schedulers.NonBlockingThread;
import io.reactivex.plugins.RxJavaPlugins;
import java.util.concurrent.CountDownLatch;
/* loaded from: classes2.dex */
public final class BlockingHelper {
public static void a(CountDownLatch countDownLatch, Disposable disposable) {
if (countDownLatch.getCount() == 0) {
return;
}
try {
a();
countDownLatch.await();
} catch (InterruptedException e) {
disposable.dispose();
Thread.currentThread().interrupt();
throw new IllegalStateException("Interrupted while waiting for subscription to complete.", e);
}
}
public static void a() {
if (RxJavaPlugins.a()) {
if ((Thread.currentThread() instanceof NonBlockingThread) || RxJavaPlugins.b()) {
throw new IllegalStateException("Attempt to block on a Scheduler " + Thread.currentThread().getName() + " that doesn't support blocking operators as they may lead to deadlock");
}
}
}
}

View File

@@ -0,0 +1,26 @@
package io.reactivex.internal.util;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import java.util.concurrent.CountDownLatch;
/* loaded from: classes2.dex */
public final class BlockingIgnoringReceiver extends CountDownLatch implements Consumer<Throwable>, Action {
public Throwable a;
public BlockingIgnoringReceiver() {
super(1);
}
@Override // io.reactivex.functions.Consumer
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void accept(Throwable th) {
this.a = th;
countDown();
}
@Override // io.reactivex.functions.Action
public void run() {
countDown();
}
}

View File

@@ -0,0 +1,67 @@
package io.reactivex.internal.util;
import io.reactivex.CompletableObserver;
import io.reactivex.FlowableSubscriber;
import io.reactivex.MaybeObserver;
import io.reactivex.Observer;
import io.reactivex.SingleObserver;
import io.reactivex.disposables.Disposable;
import io.reactivex.plugins.RxJavaPlugins;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
/* loaded from: classes2.dex */
public enum EmptyComponent implements FlowableSubscriber<Object>, Observer<Object>, MaybeObserver<Object>, SingleObserver<Object>, CompletableObserver, Subscription, Disposable {
INSTANCE;
public static <T> Observer<T> asObserver() {
return INSTANCE;
}
public static <T> Subscriber<T> asSubscriber() {
return INSTANCE;
}
@Override // org.reactivestreams.Subscription
public void cancel() {
}
@Override // io.reactivex.disposables.Disposable
public void dispose() {
}
public boolean isDisposed() {
return true;
}
@Override // org.reactivestreams.Subscriber
public void onComplete() {
}
@Override // org.reactivestreams.Subscriber
public void onError(Throwable th) {
RxJavaPlugins.b(th);
}
@Override // org.reactivestreams.Subscriber
public void onNext(Object obj) {
}
@Override // io.reactivex.Observer
public void onSubscribe(Disposable disposable) {
disposable.dispose();
}
@Override // io.reactivex.MaybeObserver
public void onSuccess(Object obj) {
}
@Override // org.reactivestreams.Subscription
public void request(long j) {
}
@Override // org.reactivestreams.Subscriber
public void onSubscribe(Subscription subscription) {
subscription.cancel();
}
}

View File

@@ -0,0 +1,45 @@
package io.reactivex.internal.util;
import io.reactivex.disposables.Disposable;
import io.reactivex.exceptions.ProtocolViolationException;
import io.reactivex.internal.disposables.DisposableHelper;
import io.reactivex.internal.functions.ObjectHelper;
import io.reactivex.plugins.RxJavaPlugins;
import java.util.concurrent.atomic.AtomicReference;
/* loaded from: classes2.dex */
public final class EndConsumerHelper {
public static boolean a(Disposable disposable, Disposable disposable2, Class<?> cls) {
ObjectHelper.a(disposable2, "next is null");
if (disposable == null) {
return true;
}
disposable2.dispose();
if (disposable == DisposableHelper.DISPOSED) {
return false;
}
a(cls);
return false;
}
public static boolean a(AtomicReference<Disposable> atomicReference, Disposable disposable, Class<?> cls) {
ObjectHelper.a(disposable, "next is null");
if (atomicReference.compareAndSet(null, disposable)) {
return true;
}
disposable.dispose();
if (atomicReference.get() == DisposableHelper.DISPOSED) {
return false;
}
a(cls);
return false;
}
public static String a(String str) {
return "It is not allowed to subscribe with a(n) " + str + " multiple times. Please create a fresh instance of " + str + " and subscribe that to the target source instead.";
}
public static void a(Class<?> cls) {
RxJavaPlugins.b(new ProtocolViolationException(a(cls.getName())));
}
}

View File

@@ -0,0 +1,8 @@
package io.reactivex.internal.util;
/* loaded from: classes2.dex */
public enum ErrorMode {
IMMEDIATE,
BOUNDARY,
END
}

View File

@@ -0,0 +1,44 @@
package io.reactivex.internal.util;
import io.reactivex.exceptions.CompositeException;
import java.util.concurrent.atomic.AtomicReference;
/* loaded from: classes2.dex */
public final class ExceptionHelper {
public static final Throwable a = new Termination();
static final class Termination extends Throwable {
Termination() {
super("No further exceptions");
}
@Override // java.lang.Throwable
public Throwable fillInStackTrace() {
return this;
}
}
public static RuntimeException a(Throwable th) {
if (th instanceof Error) {
throw ((Error) th);
}
return th instanceof RuntimeException ? (RuntimeException) th : new RuntimeException(th);
}
public static <T> boolean a(AtomicReference<Throwable> atomicReference, Throwable th) {
Throwable th2;
do {
th2 = atomicReference.get();
if (th2 == a) {
return false;
}
} while (!atomicReference.compareAndSet(th2, th2 == null ? th : new CompositeException(th2, th)));
return true;
}
public static <T> Throwable a(AtomicReference<Throwable> atomicReference) {
Throwable th = atomicReference.get();
Throwable th2 = a;
return th != th2 ? atomicReference.getAndSet(th2) : th;
}
}

View File

@@ -0,0 +1,83 @@
package io.reactivex.internal.util;
import io.reactivex.Observer;
import io.reactivex.plugins.RxJavaPlugins;
import java.util.concurrent.atomic.AtomicInteger;
import org.reactivestreams.Subscriber;
/* loaded from: classes2.dex */
public final class HalfSerializer {
/* JADX WARN: Multi-variable type inference failed */
public static <T> void a(Subscriber<? super T> subscriber, T t, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
if (atomicInteger.get() == 0 && atomicInteger.compareAndSet(0, 1)) {
subscriber.onNext(t);
if (atomicInteger.decrementAndGet() != 0) {
Throwable terminate = atomicThrowable.terminate();
if (terminate != null) {
subscriber.onError(terminate);
} else {
subscriber.onComplete();
}
}
}
}
public static void a(Subscriber<?> subscriber, Throwable th, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
if (atomicThrowable.addThrowable(th)) {
if (atomicInteger.getAndIncrement() == 0) {
subscriber.onError(atomicThrowable.terminate());
return;
}
return;
}
RxJavaPlugins.b(th);
}
public static void a(Subscriber<?> subscriber, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
if (atomicInteger.getAndIncrement() == 0) {
Throwable terminate = atomicThrowable.terminate();
if (terminate != null) {
subscriber.onError(terminate);
} else {
subscriber.onComplete();
}
}
}
/* JADX WARN: Multi-variable type inference failed */
public static <T> void a(Observer<? super T> observer, T t, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
if (atomicInteger.get() == 0 && atomicInteger.compareAndSet(0, 1)) {
observer.onNext(t);
if (atomicInteger.decrementAndGet() != 0) {
Throwable terminate = atomicThrowable.terminate();
if (terminate != null) {
observer.onError(terminate);
} else {
observer.onComplete();
}
}
}
}
public static void a(Observer<?> observer, Throwable th, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
if (atomicThrowable.addThrowable(th)) {
if (atomicInteger.getAndIncrement() == 0) {
observer.onError(atomicThrowable.terminate());
return;
}
return;
}
RxJavaPlugins.b(th);
}
public static void a(Observer<?> observer, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
if (atomicInteger.getAndIncrement() == 0) {
Throwable terminate = atomicThrowable.terminate();
if (terminate != null) {
observer.onError(terminate);
} else {
observer.onComplete();
}
}
}
}

View File

@@ -0,0 +1,19 @@
package io.reactivex.internal.util;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
/* loaded from: classes2.dex */
public enum HashMapSupplier implements Callable<Map<Object, Object>> {
INSTANCE;
public static <K, V> Callable<Map<K, V>> asCallable() {
return INSTANCE;
}
@Override // java.util.concurrent.Callable
public Map<Object, Object> call() throws Exception {
return new HashMap();
}
}

View File

@@ -0,0 +1,71 @@
package io.reactivex.internal.util;
import java.util.ArrayList;
/* loaded from: classes2.dex */
public class LinkedArrayList {
final int a;
Object[] b;
Object[] c;
volatile int d;
int e;
public LinkedArrayList(int i) {
this.a = i;
}
public void a(Object obj) {
if (this.d == 0) {
this.b = new Object[this.a + 1];
Object[] objArr = this.b;
this.c = objArr;
objArr[0] = obj;
this.e = 1;
this.d = 1;
return;
}
int i = this.e;
int i2 = this.a;
if (i != i2) {
this.c[i] = obj;
this.e = i + 1;
this.d++;
} else {
Object[] objArr2 = new Object[i2 + 1];
objArr2[0] = obj;
this.c[i2] = objArr2;
this.c = objArr2;
this.e = 1;
this.d++;
}
}
public int b() {
return this.d;
}
public String toString() {
int i = this.a;
int i2 = this.d;
ArrayList arrayList = new ArrayList(i2 + 1);
Object[] a = a();
int i3 = 0;
while (true) {
int i4 = 0;
while (i3 < i2) {
arrayList.add(a[i4]);
i3++;
i4++;
if (i4 == i) {
break;
}
}
return arrayList.toString();
a = a[i];
}
}
public Object[] a() {
return this.b;
}
}

View File

@@ -0,0 +1,19 @@
package io.reactivex.internal.util;
import io.reactivex.functions.BiFunction;
import java.util.List;
/* loaded from: classes2.dex */
public enum ListAddBiConsumer implements BiFunction<List, Object, List> {
INSTANCE;
public static <T> BiFunction<List<T>, T, List<T>> instance() {
return INSTANCE;
}
@Override // io.reactivex.functions.BiFunction
public List apply(List list, Object obj) throws Exception {
list.add(obj);
return list;
}
}

View File

@@ -0,0 +1,178 @@
package io.reactivex.internal.util;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import io.reactivex.internal.functions.ObjectHelper;
import java.io.Serializable;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
/* loaded from: classes2.dex */
public enum NotificationLite {
COMPLETE;
static final class DisposableNotification implements Serializable {
final Disposable a;
DisposableNotification(Disposable disposable) {
this.a = disposable;
}
public String toString() {
return "NotificationLite.Disposable[" + this.a + "]";
}
}
static final class ErrorNotification implements Serializable {
final Throwable a;
ErrorNotification(Throwable th) {
this.a = th;
}
public boolean equals(Object obj) {
if (obj instanceof ErrorNotification) {
return ObjectHelper.a(this.a, ((ErrorNotification) obj).a);
}
return false;
}
public int hashCode() {
return this.a.hashCode();
}
public String toString() {
return "NotificationLite.Error[" + this.a + "]";
}
}
static final class SubscriptionNotification implements Serializable {
final Subscription a;
SubscriptionNotification(Subscription subscription) {
this.a = subscription;
}
public String toString() {
return "NotificationLite.Subscription[" + this.a + "]";
}
}
public static <T> boolean accept(Object obj, Subscriber<? super T> subscriber) {
if (obj == COMPLETE) {
subscriber.onComplete();
return true;
}
if (obj instanceof ErrorNotification) {
subscriber.onError(((ErrorNotification) obj).a);
return true;
}
subscriber.onNext(obj);
return false;
}
public static <T> boolean acceptFull(Object obj, Subscriber<? super T> subscriber) {
if (obj == COMPLETE) {
subscriber.onComplete();
return true;
}
if (obj instanceof ErrorNotification) {
subscriber.onError(((ErrorNotification) obj).a);
return true;
}
if (obj instanceof SubscriptionNotification) {
subscriber.onSubscribe(((SubscriptionNotification) obj).a);
return false;
}
subscriber.onNext(obj);
return false;
}
public static Object complete() {
return COMPLETE;
}
public static Object disposable(Disposable disposable) {
return new DisposableNotification(disposable);
}
public static Object error(Throwable th) {
return new ErrorNotification(th);
}
public static Disposable getDisposable(Object obj) {
return ((DisposableNotification) obj).a;
}
public static Throwable getError(Object obj) {
return ((ErrorNotification) obj).a;
}
public static Subscription getSubscription(Object obj) {
return ((SubscriptionNotification) obj).a;
}
/* JADX WARN: Multi-variable type inference failed */
public static <T> T getValue(Object obj) {
return obj;
}
public static boolean isComplete(Object obj) {
return obj == COMPLETE;
}
public static boolean isDisposable(Object obj) {
return obj instanceof DisposableNotification;
}
public static boolean isError(Object obj) {
return obj instanceof ErrorNotification;
}
public static boolean isSubscription(Object obj) {
return obj instanceof SubscriptionNotification;
}
public static <T> Object next(T t) {
return t;
}
public static Object subscription(Subscription subscription) {
return new SubscriptionNotification(subscription);
}
@Override // java.lang.Enum
public String toString() {
return "NotificationLite.Complete";
}
public static <T> boolean accept(Object obj, Observer<? super T> observer) {
if (obj == COMPLETE) {
observer.onComplete();
return true;
}
if (obj instanceof ErrorNotification) {
observer.onError(((ErrorNotification) obj).a);
return true;
}
observer.onNext(obj);
return false;
}
public static <T> boolean acceptFull(Object obj, Observer<? super T> observer) {
if (obj == COMPLETE) {
observer.onComplete();
return true;
}
if (obj instanceof ErrorNotification) {
observer.onError(((ErrorNotification) obj).a);
return true;
}
if (obj instanceof DisposableNotification) {
observer.onSubscribe(((DisposableNotification) obj).a);
return false;
}
observer.onNext(obj);
return false;
}
}

View File

@@ -0,0 +1,16 @@
package io.reactivex.internal.util;
import io.reactivex.Observer;
/* loaded from: classes2.dex */
public interface ObservableQueueDrain<T, U> {
int a(int i);
void a(Observer<? super U> observer, T t);
boolean a();
boolean b();
Throwable c();
}

View File

@@ -0,0 +1,142 @@
package io.reactivex.internal.util;
/* loaded from: classes2.dex */
public final class OpenHashSet<T> {
final float a;
int b;
int c;
int d;
T[] e;
public OpenHashSet() {
this(16, 0.75f);
}
static int a(int i) {
int i2 = i * (-1640531527);
return i2 ^ (i2 >>> 16);
}
public boolean a(T t) {
T t2;
T[] tArr = this.e;
int i = this.b;
int a = a(t.hashCode()) & i;
T t3 = tArr[a];
if (t3 != null) {
if (t3.equals(t)) {
return false;
}
do {
a = (a + 1) & i;
t2 = tArr[a];
if (t2 == null) {
}
} while (!t2.equals(t));
return false;
}
tArr[a] = t;
int i2 = this.c + 1;
this.c = i2;
if (i2 >= this.d) {
b();
}
return true;
}
public boolean b(T t) {
T t2;
T[] tArr = this.e;
int i = this.b;
int a = a(t.hashCode()) & i;
T t3 = tArr[a];
if (t3 == null) {
return false;
}
if (t3.equals(t)) {
return a(a, tArr, i);
}
do {
a = (a + 1) & i;
t2 = tArr[a];
if (t2 == null) {
return false;
}
} while (!t2.equals(t));
return a(a, tArr, i);
}
public int c() {
return this.c;
}
public OpenHashSet(int i, float f) {
this.a = f;
int a = Pow2.a(i);
this.b = a - 1;
this.d = (int) (f * a);
this.e = (T[]) new Object[a];
}
void b() {
T[] tArr = this.e;
int length = tArr.length;
int i = length << 1;
int i2 = i - 1;
T[] tArr2 = (T[]) new Object[i];
int i3 = this.c;
while (true) {
int i4 = i3 - 1;
if (i3 != 0) {
do {
length--;
} while (tArr[length] == null);
int a = a(tArr[length].hashCode()) & i2;
if (tArr2[a] != null) {
do {
a = (a + 1) & i2;
} while (tArr2[a] != null);
}
tArr2[a] = tArr[length];
i3 = i4;
} else {
this.b = i2;
this.d = (int) (i * this.a);
this.e = tArr2;
return;
}
}
}
boolean a(int i, T[] tArr, int i2) {
int i3;
T t;
this.c--;
while (true) {
int i4 = i + 1;
while (true) {
i3 = i4 & i2;
t = tArr[i3];
if (t == null) {
tArr[i] = null;
return true;
}
int a = a(t.hashCode()) & i2;
if (i > i3) {
if (i >= a && a > i3) {
break;
}
i4 = i3 + 1;
} else if (i < a && a <= i3) {
i4 = i3 + 1;
}
}
tArr[i] = t;
i = i3;
}
}
public Object[] a() {
return this.e;
}
}

View File

@@ -0,0 +1,8 @@
package io.reactivex.internal.util;
/* loaded from: classes2.dex */
public final class Pow2 {
public static int a(int i) {
return 1 << (32 - Integer.numberOfLeadingZeros(i - 1));
}
}

View File

@@ -0,0 +1,128 @@
package io.reactivex.internal.util;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import io.reactivex.internal.fuseable.SimpleQueue;
import io.reactivex.internal.queue.SpscArrayQueue;
import io.reactivex.internal.queue.SpscLinkedArrayQueue;
import org.reactivestreams.Subscription;
/* loaded from: classes2.dex */
public final class QueueDrainHelper {
/* JADX WARN: Code restructure failed: missing block: B:12:0x0033, code lost:
r1 = r15.a(-r1);
*/
/* JADX WARN: Code restructure failed: missing block: B:13:0x0038, code lost:
if (r1 != 0) goto L21;
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x003a, code lost:
return;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public static <T, U> void a(io.reactivex.internal.fuseable.SimplePlainQueue<T> r11, io.reactivex.Observer<? super U> r12, boolean r13, io.reactivex.disposables.Disposable r14, io.reactivex.internal.util.ObservableQueueDrain<T, U> r15) {
/*
r0 = 1
r1 = 1
L2:
boolean r2 = r15.a()
boolean r3 = r11.isEmpty()
r4 = r12
r5 = r13
r6 = r11
r7 = r14
r8 = r15
boolean r2 = a(r2, r3, r4, r5, r6, r7, r8)
if (r2 == 0) goto L16
return
L16:
boolean r3 = r15.a()
java.lang.Object r2 = r11.poll()
if (r2 != 0) goto L22
r10 = 1
goto L24
L22:
r4 = 0
r10 = 0
L24:
r4 = r10
r5 = r12
r6 = r13
r7 = r11
r8 = r14
r9 = r15
boolean r3 = a(r3, r4, r5, r6, r7, r8, r9)
if (r3 == 0) goto L31
return
L31:
if (r10 == 0) goto L3b
int r1 = -r1
int r1 = r15.a(r1)
if (r1 != 0) goto L2
return
L3b:
r15.a(r12, r2)
goto L16
*/
throw new UnsupportedOperationException("Method not decompiled: io.reactivex.internal.util.QueueDrainHelper.a(io.reactivex.internal.fuseable.SimplePlainQueue, io.reactivex.Observer, boolean, io.reactivex.disposables.Disposable, io.reactivex.internal.util.ObservableQueueDrain):void");
}
public static <T, U> boolean a(boolean z, boolean z2, Observer<?> observer, boolean z3, SimpleQueue<?> simpleQueue, Disposable disposable, ObservableQueueDrain<T, U> observableQueueDrain) {
if (observableQueueDrain.b()) {
simpleQueue.clear();
disposable.dispose();
return true;
}
if (!z) {
return false;
}
if (z3) {
if (!z2) {
return false;
}
if (disposable != null) {
disposable.dispose();
}
Throwable c = observableQueueDrain.c();
if (c != null) {
observer.onError(c);
} else {
observer.onComplete();
}
return true;
}
Throwable c2 = observableQueueDrain.c();
if (c2 != null) {
simpleQueue.clear();
if (disposable != null) {
disposable.dispose();
}
observer.onError(c2);
return true;
}
if (!z2) {
return false;
}
if (disposable != null) {
disposable.dispose();
}
observer.onComplete();
return true;
}
public static <T> SimpleQueue<T> a(int i) {
if (i < 0) {
return new SpscLinkedArrayQueue(-i);
}
return new SpscArrayQueue(i);
}
public static void a(Subscription subscription, int i) {
subscription.request(i < 0 ? Long.MAX_VALUE : i);
}
}

View File

@@ -0,0 +1,169 @@
package io.reactivex.internal.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.RandomAccess;
import java.util.concurrent.atomic.AtomicInteger;
/* loaded from: classes2.dex */
public final class VolatileSizeArrayList<T> extends AtomicInteger implements List<T>, RandomAccess {
private static final long serialVersionUID = 3972397474470203923L;
final ArrayList<T> list;
public VolatileSizeArrayList() {
this.list = new ArrayList<>();
}
@Override // java.util.List, java.util.Collection
public boolean add(T t) {
boolean add = this.list.add(t);
lazySet(this.list.size());
return add;
}
@Override // java.util.List, java.util.Collection
public boolean addAll(Collection<? extends T> collection) {
boolean addAll = this.list.addAll(collection);
lazySet(this.list.size());
return addAll;
}
@Override // java.util.List, java.util.Collection
public void clear() {
this.list.clear();
lazySet(0);
}
@Override // java.util.List, java.util.Collection
public boolean contains(Object obj) {
return this.list.contains(obj);
}
@Override // java.util.List, java.util.Collection
public boolean containsAll(Collection<?> collection) {
return this.list.containsAll(collection);
}
@Override // java.util.List, java.util.Collection
public boolean equals(Object obj) {
return obj instanceof VolatileSizeArrayList ? this.list.equals(((VolatileSizeArrayList) obj).list) : this.list.equals(obj);
}
@Override // java.util.List
public T get(int i) {
return this.list.get(i);
}
@Override // java.util.List, java.util.Collection
public int hashCode() {
return this.list.hashCode();
}
@Override // java.util.List
public int indexOf(Object obj) {
return this.list.indexOf(obj);
}
@Override // java.util.List, java.util.Collection
public boolean isEmpty() {
return get() == 0;
}
@Override // java.util.List, java.util.Collection, java.lang.Iterable
public Iterator<T> iterator() {
return this.list.iterator();
}
@Override // java.util.List
public int lastIndexOf(Object obj) {
return this.list.lastIndexOf(obj);
}
@Override // java.util.List
public ListIterator<T> listIterator() {
return this.list.listIterator();
}
@Override // java.util.List, java.util.Collection
public boolean remove(Object obj) {
boolean remove = this.list.remove(obj);
lazySet(this.list.size());
return remove;
}
@Override // java.util.List, java.util.Collection
public boolean removeAll(Collection<?> collection) {
boolean removeAll = this.list.removeAll(collection);
lazySet(this.list.size());
return removeAll;
}
@Override // java.util.List, java.util.Collection
public boolean retainAll(Collection<?> collection) {
boolean retainAll = this.list.retainAll(collection);
lazySet(this.list.size());
return retainAll;
}
@Override // java.util.List
public T set(int i, T t) {
return this.list.set(i, t);
}
@Override // java.util.List, java.util.Collection
public int size() {
return get();
}
@Override // java.util.List
public List<T> subList(int i, int i2) {
return this.list.subList(i, i2);
}
@Override // java.util.List, java.util.Collection
public Object[] toArray() {
return this.list.toArray();
}
@Override // java.util.concurrent.atomic.AtomicInteger
public String toString() {
return this.list.toString();
}
@Override // java.util.List
public ListIterator<T> listIterator(int i) {
return this.list.listIterator(i);
}
@Override // java.util.List, java.util.Collection
public <E> E[] toArray(E[] eArr) {
return (E[]) this.list.toArray(eArr);
}
public VolatileSizeArrayList(int i) {
this.list = new ArrayList<>(i);
}
@Override // java.util.List
public void add(int i, T t) {
this.list.add(i, t);
lazySet(this.list.size());
}
@Override // java.util.List
public boolean addAll(int i, Collection<? extends T> collection) {
boolean addAll = this.list.addAll(i, collection);
lazySet(this.list.size());
return addAll;
}
@Override // java.util.List
public T remove(int i) {
T remove = this.list.remove(i);
lazySet(this.list.size());
return remove;
}
}