Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2771a2d3 authored by Nicolò Mazzucato's avatar Nicolò Mazzucato Committed by Android (Google) Code Review
Browse files

Merge "Always enable tracing of PendingTaskContainer" into main

parents 71915dd3 6ef5813e
Loading
Loading
Loading
Loading
+2 −9
Original line number Original line Diff line number Diff line
@@ -37,19 +37,13 @@ class PendingTasksContainer {
     */
     */
    fun registerTask(name: String): Runnable {
    fun registerTask(name: String): Runnable {
        pendingTasksCount.incrementAndGet()
        pendingTasksCount.incrementAndGet()

        if (ENABLE_TRACE) {
        Trace.beginAsyncSection("PendingTasksContainer#$name", 0)
        Trace.beginAsyncSection("PendingTasksContainer#$name", 0)
        }


        return Runnable {
        return Runnable {
            Trace.endAsyncSection("PendingTasksContainer#$name", 0)
            if (pendingTasksCount.decrementAndGet() == 0) {
            if (pendingTasksCount.decrementAndGet() == 0) {
                val onComplete = completionCallback.getAndSet(null)
                val onComplete = completionCallback.getAndSet(null)
                onComplete?.run()
                onComplete?.run()

                if (ENABLE_TRACE) {
                    Trace.endAsyncSection("PendingTasksContainer#$name", 0)
                }
            }
            }
        }
        }
    }
    }
@@ -82,4 +76,3 @@ class PendingTasksContainer {
    fun getPendingCount(): Int = pendingTasksCount.get()
    fun getPendingCount(): Int = pendingTasksCount.get()
}
}
private const val ENABLE_TRACE = false