fix: Re-added functions in ExecutorsModule.kt

This commit is contained in:
Pun Butrach
2025-11-17 20:52:42 +07:00
parent 4ccd78ff1e
commit dafe6fbd90
2 changed files with 71 additions and 4 deletions

View File

@@ -66,6 +66,76 @@ import kotlinx.coroutines.asCoroutineDispatcher
@Module
interface ExecutorsModule {
// Unordered background executors
@Binds
@ThreadPool
fun provideThreadPoolExecutor(
@ThreadPool listeningExecutorService: ListeningExecutorService
): Executor
@Binds
@ThreadPool
fun provideThreadPoolExecutorService(
@ThreadPool listeningExecutorService: ListeningExecutorService
): ExecutorService
// end unordered background executors
// Ordered background executors
@Binds
@Background
fun provideBackgroundExecutor(
@Background listeningExecutorService: ListeningExecutorService
): Executor
@Binds
@Background
fun provideBackgroundExecutorService(
@Background listeningExecutorService: ListeningExecutorService
): ExecutorService
@Binds
@LightweightBackground(LightweightBackgroundPriority.UI)
fun provideUiLightweightBackgroundExecutor(
@LightweightBackground(LightweightBackgroundPriority.UI)
listeningExecutorService: ListeningExecutorService
): Executor
@Binds
@LightweightBackground(LightweightBackgroundPriority.UI)
fun provideUiLightweightBackgroundExecutorService(
@LightweightBackground(LightweightBackgroundPriority.UI)
listeningExecutorService: ListeningExecutorService
): ExecutorService
@Binds
@LightweightBackground(LightweightBackgroundPriority.DATA)
fun provideDataLightweightBackgroundExecutor(
@LightweightBackground(LightweightBackgroundPriority.DATA)
listeningExecutorService: ListeningExecutorService
): Executor
@Binds
@LightweightBackground(LightweightBackgroundPriority.DATA)
fun provideDataLightweightBackgroundExecutorService(
@LightweightBackground(LightweightBackgroundPriority.DATA)
listeningExecutorService: ListeningExecutorService
): ExecutorService
// end ordered background executors
// UI executors
@Binds
@Ui
fun provideUiExecutor(
@Ui listeningExecutorService: ListeningExecutorService
): Executor
@Binds
@Ui
fun provideUiExecutorService(
@Ui listeningExecutorService: ListeningExecutorService
): ExecutorService
// end UI executors
// The following methods provide the CoroutineContext for the executors.
companion object {

View File

@@ -34,9 +34,6 @@ import dagger.Module
import dagger.Binds
import dagger.Provides
import java.util.concurrent.Executor
import java.util.concurrent.ExecutorService
/**
* Module that provides the executors for Launcher3 as per the [ExecutorsModule]
* interface.
@@ -89,4 +86,4 @@ abstract class LauncherExecutorsModule {
return MoreExecutors.listeningDecorator(Executors.THREAD_POOL_EXECUTOR)
}
}
}
}