Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mlykotom committed Apr 24, 2024
1 parent 42cf1a5 commit d100dff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions coil-base/src/main/java/coil/RealImageLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ internal class RealImageLoader(
}

override suspend fun execute(request: ImageRequest) = coroutineScope {
// We don't use the async call that returns the job for Compose to micro-optimize the performance.
// The job is only needed in case of the Views implementation.

if (request.target is ViewTarget<*>) {
// Start executing the request on the main thread.
val job = async(Dispatchers.Main.immediate) {
Expand All @@ -134,6 +137,7 @@ internal class RealImageLoader(

job.await()
} else {
// Start executing the request on the main thread.
withContext(Dispatchers.Main.immediate) {
executeMain(request, REQUEST_TYPE_EXECUTE)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,5 @@ class MicroSecondsTraceSectionMetric(
),
)
}

}
}

0 comments on commit d100dff

Please sign in to comment.