mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
124 lines
8.4 KiB
Java
124 lines
8.4 KiB
Java
package androidx.room;
|
|
|
|
import android.os.CancellationSignal;
|
|
import androidx.sqlite.db.SupportSQLiteCompat;
|
|
import java.util.concurrent.Callable;
|
|
import java.util.concurrent.CancellationException;
|
|
import kotlin.Metadata;
|
|
import kotlin.Unit;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.coroutines.intrinsics.IntrinsicsKt;
|
|
import kotlin.coroutines.jvm.internal.DebugProbesKt;
|
|
import kotlin.jvm.JvmStatic;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlinx.coroutines.BuildersKt;
|
|
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
|
|
import kotlinx.coroutines.CancellableContinuationImpl;
|
|
import kotlinx.coroutines.CoroutineDispatcher;
|
|
import kotlinx.coroutines.GlobalScope;
|
|
import kotlinx.coroutines.Job;
|
|
import kotlinx.coroutines.flow.Flow;
|
|
import kotlinx.coroutines.flow.FlowKt;
|
|
|
|
/* compiled from: CoroutinesRoom.kt */
|
|
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0003\b\u0007\u0018\u0000 \u00032\u00020\u0001:\u0001\u0003B\u0007\b\u0002¢\u0006\u0002\u0010\u0002¨\u0006\u0004"}, d2 = {"Landroidx/room/CoroutinesRoom;", "", "()V", "Companion", "room-ktx_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public final class CoroutinesRoom {
|
|
|
|
/* renamed from: Companion, reason: from kotlin metadata */
|
|
public static final Companion INSTANCE = new Companion(null);
|
|
|
|
@JvmStatic
|
|
public static final <R> Flow<R> createFlow(RoomDatabase roomDatabase, boolean z, String[] strArr, Callable<R> callable) {
|
|
return INSTANCE.createFlow(roomDatabase, z, strArr, callable);
|
|
}
|
|
|
|
@JvmStatic
|
|
public static final <R> Object execute(RoomDatabase roomDatabase, boolean z, CancellationSignal cancellationSignal, Callable<R> callable, Continuation<? super R> continuation) {
|
|
return INSTANCE.execute(roomDatabase, z, cancellationSignal, callable, continuation);
|
|
}
|
|
|
|
@JvmStatic
|
|
public static final <R> Object execute(RoomDatabase roomDatabase, boolean z, Callable<R> callable, Continuation<? super R> continuation) {
|
|
return INSTANCE.execute(roomDatabase, z, callable, continuation);
|
|
}
|
|
|
|
private CoroutinesRoom() {
|
|
}
|
|
|
|
/* compiled from: CoroutinesRoom.kt */
|
|
@Metadata(d1 = {"\u0000>\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002JJ\u0010\u0003\u001a\r\u0012\t\u0012\u0007H\u0005¢\u0006\u0002\b\u00060\u0004\"\u0004\b\u0000\u0010\u00052\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\n2\f\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\r0\f2\f\u0010\u000e\u001a\b\u0012\u0004\u0012\u0002H\u00050\u000fH\u0007¢\u0006\u0002\u0010\u0010J=\u0010\u0011\u001a\u0002H\u0005\"\u0004\b\u0000\u0010\u00052\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u0012\u001a\u00020\u00132\f\u0010\u000e\u001a\b\u0012\u0004\u0012\u0002H\u00050\u000fH\u0087@ø\u0001\u0000¢\u0006\u0002\u0010\u0014J5\u0010\u0011\u001a\u0002H\u0005\"\u0004\b\u0000\u0010\u00052\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\n2\f\u0010\u000e\u001a\b\u0012\u0004\u0012\u0002H\u00050\u000fH\u0087@ø\u0001\u0000¢\u0006\u0002\u0010\u0015\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u0016"}, d2 = {"Landroidx/room/CoroutinesRoom$Companion;", "", "()V", "createFlow", "Lkotlinx/coroutines/flow/Flow;", "R", "Lkotlin/jvm/JvmSuppressWildcards;", "db", "Landroidx/room/RoomDatabase;", "inTransaction", "", "tableNames", "", "", "callable", "Ljava/util/concurrent/Callable;", "(Landroidx/room/RoomDatabase;Z[Ljava/lang/String;Ljava/util/concurrent/Callable;)Lkotlinx/coroutines/flow/Flow;", "execute", "cancellationSignal", "Landroid/os/CancellationSignal;", "(Landroidx/room/RoomDatabase;ZLandroid/os/CancellationSignal;Ljava/util/concurrent/Callable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "(Landroidx/room/RoomDatabase;ZLjava/util/concurrent/Callable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "room-ktx_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
@JvmStatic
|
|
public final <R> Object execute(RoomDatabase roomDatabase, boolean z, Callable<R> callable, Continuation<? super R> continuation) {
|
|
CoroutineDispatcher transactionDispatcher;
|
|
if (roomDatabase.isOpen() && roomDatabase.inTransaction()) {
|
|
return callable.call();
|
|
}
|
|
TransactionElement transactionElement = (TransactionElement) continuation.get$context().get(TransactionElement.INSTANCE);
|
|
if (transactionElement == null || (transactionDispatcher = transactionElement.getTransactionDispatcher()) == null) {
|
|
transactionDispatcher = z ? CoroutinesRoomKt.getTransactionDispatcher(roomDatabase) : CoroutinesRoomKt.getQueryDispatcher(roomDatabase);
|
|
}
|
|
return BuildersKt.withContext(transactionDispatcher, new CoroutinesRoom$Companion$execute$2(callable, null), continuation);
|
|
}
|
|
|
|
@JvmStatic
|
|
public final <R> Object execute(RoomDatabase roomDatabase, boolean z, final CancellationSignal cancellationSignal, Callable<R> callable, Continuation<? super R> continuation) {
|
|
CoroutineDispatcher transactionDispatcher;
|
|
final Job launch$default;
|
|
if (roomDatabase.isOpen() && roomDatabase.inTransaction()) {
|
|
return callable.call();
|
|
}
|
|
TransactionElement transactionElement = (TransactionElement) continuation.get$context().get(TransactionElement.INSTANCE);
|
|
if (transactionElement == null || (transactionDispatcher = transactionElement.getTransactionDispatcher()) == null) {
|
|
transactionDispatcher = z ? CoroutinesRoomKt.getTransactionDispatcher(roomDatabase) : CoroutinesRoomKt.getQueryDispatcher(roomDatabase);
|
|
}
|
|
CancellableContinuationImpl cancellableContinuationImpl = new CancellableContinuationImpl(IntrinsicsKt.intercepted(continuation), 1);
|
|
cancellableContinuationImpl.initCancellability();
|
|
CancellableContinuationImpl cancellableContinuationImpl2 = cancellableContinuationImpl;
|
|
launch$default = BuildersKt__Builders_commonKt.launch$default(GlobalScope.INSTANCE, transactionDispatcher, null, new CoroutinesRoom$Companion$execute$4$job$1(callable, cancellableContinuationImpl2, null), 2, null);
|
|
cancellableContinuationImpl2.invokeOnCancellation(new Function1<Throwable, Unit>() { // from class: androidx.room.CoroutinesRoom$Companion$execute$4$1
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(1);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
|
|
invoke2(th);
|
|
return Unit.INSTANCE;
|
|
}
|
|
|
|
/* renamed from: invoke, reason: avoid collision after fix types in other method */
|
|
public final void invoke2(Throwable th) {
|
|
SupportSQLiteCompat.Api16Impl.cancel(cancellationSignal);
|
|
Job.DefaultImpls.cancel$default(launch$default, (CancellationException) null, 1, (Object) null);
|
|
}
|
|
});
|
|
Object result = cancellableContinuationImpl.getResult();
|
|
if (result == IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
|
|
DebugProbesKt.probeCoroutineSuspended(continuation);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
@JvmStatic
|
|
public final <R> Flow<R> createFlow(RoomDatabase db, boolean inTransaction, String[] tableNames, Callable<R> callable) {
|
|
Intrinsics.checkNotNullParameter(db, "db");
|
|
Intrinsics.checkNotNullParameter(tableNames, "tableNames");
|
|
Intrinsics.checkNotNullParameter(callable, "callable");
|
|
return FlowKt.flow(new CoroutinesRoom$Companion$createFlow$1(inTransaction, db, tableNames, callable, null));
|
|
}
|
|
}
|
|
}
|