Loading packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/Network.kt +4 −8 Original line number Original line Diff line number Diff line Loading @@ -74,7 +74,7 @@ internal class Network( private val muxMovers = ArrayDeque<MuxDeferredNode<*, *, *>>() private val muxMovers = ArrayDeque<MuxDeferredNode<*, *, *>>() private val deactivations = ArrayDeque<PushNode<*>>() private val deactivations = ArrayDeque<PushNode<*>>() private val outputDeactivations = ArrayDeque<Output<*>>() private val outputDeactivations = ArrayDeque<Output<*>>() private val inputScheduleChan = Channel<ScheduledAction<*>>() private val inputScheduleChan = Channel<ScheduledAction<*>>(Channel.UNLIMITED) override fun scheduleOutput(output: Output<*>) { override fun scheduleOutput(output: Output<*>) { fastOutputs.add(output) fastOutputs.add(output) Loading Loading @@ -169,14 +169,10 @@ internal class Network( onResult.cancel() onResult.cancel() return@also return@also } } val job = inputScheduleChan.trySend( coroutineScope.launch { inputScheduleChan.send( ScheduledAction(reason, onStartTransaction = block, onResult = onResult) ScheduledAction(reason, onStartTransaction = block, onResult = onResult) ) ) } } onResult.invokeOnCompletion { job.cancel() } } inline fun <R> runThenDrainDeferrals(block: () -> R): R = inline fun <R> runThenDrainDeferrals(block: () -> R): R = block().also { deferScopeImpl.drainDeferrals() } block().also { deferScopeImpl.drainDeferrals() } Loading Loading
packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/Network.kt +4 −8 Original line number Original line Diff line number Diff line Loading @@ -74,7 +74,7 @@ internal class Network( private val muxMovers = ArrayDeque<MuxDeferredNode<*, *, *>>() private val muxMovers = ArrayDeque<MuxDeferredNode<*, *, *>>() private val deactivations = ArrayDeque<PushNode<*>>() private val deactivations = ArrayDeque<PushNode<*>>() private val outputDeactivations = ArrayDeque<Output<*>>() private val outputDeactivations = ArrayDeque<Output<*>>() private val inputScheduleChan = Channel<ScheduledAction<*>>() private val inputScheduleChan = Channel<ScheduledAction<*>>(Channel.UNLIMITED) override fun scheduleOutput(output: Output<*>) { override fun scheduleOutput(output: Output<*>) { fastOutputs.add(output) fastOutputs.add(output) Loading Loading @@ -169,14 +169,10 @@ internal class Network( onResult.cancel() onResult.cancel() return@also return@also } } val job = inputScheduleChan.trySend( coroutineScope.launch { inputScheduleChan.send( ScheduledAction(reason, onStartTransaction = block, onResult = onResult) ScheduledAction(reason, onStartTransaction = block, onResult = onResult) ) ) } } onResult.invokeOnCompletion { job.cancel() } } inline fun <R> runThenDrainDeferrals(block: () -> R): R = inline fun <R> runThenDrainDeferrals(block: () -> R): R = block().also { deferScopeImpl.drainDeferrals() } block().also { deferScopeImpl.drainDeferrals() } Loading