Rabbit-R1/switch port/java/sources/androidx/compose/runtime/SnapshotContextElementImpl.java
2024-05-21 17:08:36 -04:00

60 lines
3.8 KiB
Java

package androidx.compose.runtime;
import androidx.compose.runtime.snapshots.Snapshot;
import androidx.compose.runtime.snapshots.SnapshotContextElement;
import io.sentry.protocol.SentryStackTrace;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.ThreadContextElement;
/* compiled from: ActualJvm.jvm.kt */
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0001\u0018\u00002\u00020\u00012\n\u0012\u0006\u0012\u0004\u0018\u00010\u00030\u0002B\r\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005J\u001a\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\r2\b\u0010\u000e\u001a\u0004\u0018\u00010\u0003H\u0016J\u0012\u0010\u000f\u001a\u0004\u0018\u00010\u00032\u0006\u0010\f\u001a\u00020\rH\u0016R\u0018\u0010\u0006\u001a\u0006\u0012\u0002\b\u00030\u00078VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\b\u0010\tR\u000e\u0010\u0004\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0010"}, d2 = {"Landroidx/compose/runtime/SnapshotContextElementImpl;", "Landroidx/compose/runtime/snapshots/SnapshotContextElement;", "Lkotlinx/coroutines/ThreadContextElement;", "Landroidx/compose/runtime/snapshots/Snapshot;", SentryStackTrace.JsonKeys.SNAPSHOT, "(Landroidx/compose/runtime/snapshots/Snapshot;)V", "key", "Lkotlin/coroutines/CoroutineContext$Key;", "getKey", "()Lkotlin/coroutines/CoroutineContext$Key;", "restoreThreadContext", "", "context", "Lkotlin/coroutines/CoroutineContext;", "oldState", "updateThreadContext", "runtime_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class SnapshotContextElementImpl implements SnapshotContextElement, ThreadContextElement<Snapshot> {
private final Snapshot snapshot;
public SnapshotContextElementImpl(Snapshot snapshot) {
Intrinsics.checkNotNullParameter(snapshot, "snapshot");
this.snapshot = snapshot;
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public <R> R fold(R r, Function2<? super R, ? super CoroutineContext.Element, ? extends R> function2) {
return (R) SnapshotContextElement.DefaultImpls.fold(this, r, function2);
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public <E extends CoroutineContext.Element> E get(CoroutineContext.Key<E> key) {
return (E) SnapshotContextElement.DefaultImpls.get(this, key);
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public CoroutineContext minusKey(CoroutineContext.Key<?> key) {
return SnapshotContextElement.DefaultImpls.minusKey(this, key);
}
@Override // kotlin.coroutines.CoroutineContext
public CoroutineContext plus(CoroutineContext coroutineContext) {
return SnapshotContextElement.DefaultImpls.plus(this, coroutineContext);
}
@Override // kotlin.coroutines.CoroutineContext.Element
public CoroutineContext.Key<?> getKey() {
return SnapshotContextElement.INSTANCE;
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // kotlinx.coroutines.ThreadContextElement
public Snapshot updateThreadContext(CoroutineContext context) {
Intrinsics.checkNotNullParameter(context, "context");
return this.snapshot.unsafeEnter();
}
@Override // kotlinx.coroutines.ThreadContextElement
public void restoreThreadContext(CoroutineContext context, Snapshot oldState) {
Intrinsics.checkNotNullParameter(context, "context");
this.snapshot.unsafeLeave(oldState);
}
}