109 lines
		
	
	
		
			7.1 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			109 lines
		
	
	
		
			7.1 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package kotlin.coroutines;
 | |
| 
 | |
| import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
 | |
| import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 | |
| import kotlin.Metadata;
 | |
| import kotlin.Result;
 | |
| import kotlin.coroutines.intrinsics.CoroutineSingletons;
 | |
| import kotlin.coroutines.intrinsics.IntrinsicsKt;
 | |
| import kotlin.coroutines.jvm.internal.CoroutineStackFrame;
 | |
| import kotlin.jvm.internal.DefaultConstructorMarker;
 | |
| import kotlin.jvm.internal.Intrinsics;
 | |
| 
 | |
| /* compiled from: SafeContinuationJvm.kt */
 | |
| @Metadata(d1 = {"\u0000<\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0000\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0001\u0018\u0000 \u001a*\u0006\b\u0000\u0010\u0001 \u00002\b\u0012\u0004\u0012\u0002H\u00010\u00022\u00020\u0003:\u0001\u001aB\u0015\b\u0011\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00000\u0002¢\u0006\u0002\u0010\u0005B\u001f\b\u0000\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00000\u0002\u0012\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007¢\u0006\u0002\u0010\bJ\n\u0010\u0011\u001a\u0004\u0018\u00010\u0007H\u0001J\n\u0010\u0012\u001a\u0004\u0018\u00010\u0013H\u0016J\u001e\u0010\u0014\u001a\u00020\u00152\f\u0010\u0010\u001a\b\u0012\u0004\u0012\u00028\u00000\u0016H\u0016ø\u0001\u0000¢\u0006\u0002\u0010\u0017J\b\u0010\u0018\u001a\u00020\u0019H\u0016R\u0016\u0010\t\u001a\u0004\u0018\u00010\u00038VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\n\u0010\u000bR\u0014\u0010\f\u001a\u00020\r8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u000e\u0010\u000fR\u0014\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00000\u0002X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0010\u001a\u0004\u0018\u00010\u0007X\u0082\u000e¢\u0006\u0002\n\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u001b"}, d2 = {"Lkotlin/coroutines/SafeContinuation;", "T", "Lkotlin/coroutines/Continuation;", "Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;", "delegate", "(Lkotlin/coroutines/Continuation;)V", "initialResult", "", "(Lkotlin/coroutines/Continuation;Ljava/lang/Object;)V", "callerFrame", "getCallerFrame", "()Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;", "context", "Lkotlin/coroutines/CoroutineContext;", "getContext", "()Lkotlin/coroutines/CoroutineContext;", "result", "getOrThrow", "getStackTraceElement", "Ljava/lang/StackTraceElement;", "resumeWith", "", "Lkotlin/Result;", "(Ljava/lang/Object;)V", "toString", "", "Companion", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
 | |
| /* loaded from: classes.dex */
 | |
| public final class SafeContinuation<T> implements Continuation<T>, CoroutineStackFrame {
 | |
|     private static final Companion Companion = new Companion(null);
 | |
|     private static final AtomicReferenceFieldUpdater<SafeContinuation<?>, Object> RESULT = AtomicReferenceFieldUpdater.newUpdater(SafeContinuation.class, Object.class, "result");
 | |
|     private final Continuation<T> delegate;
 | |
|     private volatile Object result;
 | |
| 
 | |
|     @Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
 | |
|     public StackTraceElement getStackTraceElement() {
 | |
|         return null;
 | |
|     }
 | |
| 
 | |
|     /* JADX WARN: Multi-variable type inference failed */
 | |
|     public SafeContinuation(Continuation<? super T> delegate, Object obj) {
 | |
|         Intrinsics.checkNotNullParameter(delegate, "delegate");
 | |
|         this.delegate = delegate;
 | |
|         this.result = obj;
 | |
|     }
 | |
| 
 | |
|     /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
 | |
|     public SafeContinuation(Continuation<? super T> delegate) {
 | |
|         this(delegate, CoroutineSingletons.UNDECIDED);
 | |
|         Intrinsics.checkNotNullParameter(delegate, "delegate");
 | |
|     }
 | |
| 
 | |
|     @Override // kotlin.coroutines.Continuation
 | |
|     public CoroutineContext getContext() {
 | |
|         return this.delegate.getContext();
 | |
|     }
 | |
| 
 | |
|     /* compiled from: SafeContinuationJvm.kt */
 | |
|     @Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0082\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002Rd\u0010\u0003\u001aR\u0012\u0014\u0012\u0012\u0012\u0002\b\u0003 \u0006*\b\u0012\u0002\b\u0003\u0018\u00010\u00050\u0005\u0012\f\u0012\n \u0006*\u0004\u0018\u00010\u00010\u0001 \u0006*(\u0012\u0014\u0012\u0012\u0012\u0002\b\u0003 \u0006*\b\u0012\u0002\b\u0003\u0018\u00010\u00050\u0005\u0012\f\u0012\n \u0006*\u0004\u0018\u00010\u00010\u0001\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\b\n\u0000\u0012\u0004\b\u0007\u0010\u0002¨\u0006\b"}, d2 = {"Lkotlin/coroutines/SafeContinuation$Companion;", "", "()V", "RESULT", "Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;", "Lkotlin/coroutines/SafeContinuation;", "kotlin.jvm.PlatformType", "getRESULT$annotations", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
 | |
|     private static final class Companion {
 | |
|         public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
 | |
|             this();
 | |
|         }
 | |
| 
 | |
|         private static /* synthetic */ void getRESULT$annotations() {
 | |
|         }
 | |
| 
 | |
|         private Companion() {
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // kotlin.coroutines.Continuation
 | |
|     public void resumeWith(Object result) {
 | |
|         while (true) {
 | |
|             Object obj = this.result;
 | |
|             if (obj == CoroutineSingletons.UNDECIDED) {
 | |
|                 if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(RESULT, this, CoroutineSingletons.UNDECIDED, result)) {
 | |
|                     return;
 | |
|                 }
 | |
|             } else {
 | |
|                 if (obj != IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
 | |
|                     throw new IllegalStateException("Already resumed");
 | |
|                 }
 | |
|                 if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(RESULT, this, IntrinsicsKt.getCOROUTINE_SUSPENDED(), CoroutineSingletons.RESUMED)) {
 | |
|                     this.delegate.resumeWith(result);
 | |
|                     return;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public final Object getOrThrow() {
 | |
|         Object obj = this.result;
 | |
|         if (obj == CoroutineSingletons.UNDECIDED) {
 | |
|             if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(RESULT, this, CoroutineSingletons.UNDECIDED, IntrinsicsKt.getCOROUTINE_SUSPENDED())) {
 | |
|                 return IntrinsicsKt.getCOROUTINE_SUSPENDED();
 | |
|             }
 | |
|             obj = this.result;
 | |
|         }
 | |
|         if (obj == CoroutineSingletons.RESUMED) {
 | |
|             return IntrinsicsKt.getCOROUTINE_SUSPENDED();
 | |
|         }
 | |
|         if (obj instanceof Result.Failure) {
 | |
|             throw ((Result.Failure) obj).exception;
 | |
|         }
 | |
|         return obj;
 | |
|     }
 | |
| 
 | |
|     @Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
 | |
|     public CoroutineStackFrame getCallerFrame() {
 | |
|         Continuation<T> continuation = this.delegate;
 | |
|         if (continuation instanceof CoroutineStackFrame) {
 | |
|             return (CoroutineStackFrame) continuation;
 | |
|         }
 | |
|         return null;
 | |
|     }
 | |
| 
 | |
|     public String toString() {
 | |
|         return "SafeContinuation for " + this.delegate;
 | |
|     }
 | |
| }
 |