diff --git a/zipline-loader/src/nativeMain/kotlin/app/cash/zipline/loader/URLSessionZiplineHttpClient.kt b/zipline-loader/src/nativeMain/kotlin/app/cash/zipline/loader/URLSessionZiplineHttpClient.kt index d22d3c5d5e..3e7b82b371 100644 --- a/zipline-loader/src/nativeMain/kotlin/app/cash/zipline/loader/URLSessionZiplineHttpClient.kt +++ b/zipline-loader/src/nativeMain/kotlin/app/cash/zipline/loader/URLSessionZiplineHttpClient.kt @@ -17,8 +17,6 @@ package app.cash.zipline.loader import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException -import kotlin.experimental.ExperimentalNativeApi -import kotlin.native.concurrent.freeze import kotlinx.coroutines.CancellableContinuation import kotlinx.coroutines.suspendCancellableCoroutine import okio.ByteString @@ -37,10 +35,6 @@ import platform.Foundation.dataTaskWithRequest internal class URLSessionZiplineHttpClient( private val urlSession: NSURLSession, ) : ZiplineHttpClient() { - init { - maybeFreeze() - } - override suspend fun download( url: String, requestHeaders: List>, @@ -55,7 +49,7 @@ internal class URLSessionZiplineHttpClient( addValue(value = value, forHTTPHeaderField = name) } }, - completionHandler = completionHandler::invoke.maybeFreeze(), + completionHandler = completionHandler::invoke, ) continuation.invokeOnCancellation { @@ -92,13 +86,3 @@ private class CompletionHandler( continuation.resume(data.toByteString()) } } - -/** Freeze this when executing on Kotlin/Native's strict memory model. */ -@OptIn(ExperimentalNativeApi::class) -private fun T.maybeFreeze(): T { - return if (Platform.memoryModel == MemoryModel.STRICT) { - this.freeze() - } else { - this - } -}