Skip to content

Commit

Permalink
remove getLayers lock
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhirkevich Alexander Y authored and Zhirkevich Alexander Y committed Jan 21, 2025
1 parent 0ea16c4 commit 36a2a42
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import io.github.alexzhirkevich.compottie.internal.helpers.isSupported
import io.github.alexzhirkevich.compottie.internal.platform.clipRect
import io.github.alexzhirkevich.compottie.internal.platform.saveLayer
import io.github.alexzhirkevich.compottie.internal.utils.union
import kotlinx.atomicfu.locks.SynchronizedObject
import kotlinx.atomicfu.locks.synchronized
import kotlinx.serialization.Transient
import kotlin.math.absoluteValue

Expand All @@ -39,8 +37,6 @@ internal abstract class BaseCompositionLayer: BaseLayer() {
isAntiAlias = true
}

private val getLayerLock = SynchronizedObject()

protected var loadedLayers: List<BaseLayer>? = null

abstract fun compose(state: AnimationState): List<Layer>
Expand Down Expand Up @@ -113,8 +109,8 @@ internal abstract class BaseCompositionLayer: BaseLayer() {
return dynamic
}

private fun getLayers(state: AnimationState): List<Layer> = synchronized(getLayerLock) {
loadedLayers?.let { return@synchronized it }
private fun getLayers(state: AnimationState): List<Layer> {
loadedLayers?.let { return it }

val layers = compose(state).filterIsInstance<BaseLayer>()

Expand Down

0 comments on commit 36a2a42

Please sign in to comment.