From 37f2bf7f4bc038e26f110c97de0dae2f8ed5a797 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Fri, 11 Oct 2024 21:37:59 -0700 Subject: [PATCH] Refactor Systrace.traceSection() to unblock CI (#46994) Summary: This diff makes a small refactor on Systrace.traceSection() to unblock CI, which was broken by D64141515 changelog: [internal] internal Reviewed By: Abbondanzo Differential Revision: D64276651 --- .../src/main/java/com/facebook/systrace/Systrace.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/systrace/Systrace.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/systrace/Systrace.kt index 9226997df02bd9..49f63e48909fa2 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/systrace/Systrace.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/systrace/Systrace.kt @@ -8,6 +8,7 @@ package com.facebook.systrace import androidx.tracing.Trace +import java.lang.Runnable import kotlin.text.StringBuilder /** @@ -32,12 +33,12 @@ public object Systrace { @JvmStatic public fun traceInstant(tag: Long, title: String?, scope: EventScope?): Unit = Unit @JvmStatic - public fun traceSection(tag: Long, sectionName: String, block: () -> T) { - beginSection(sectionName) + public fun traceSection(tag: Long, sectionName: String, block: Runnable) { + beginSection(tag, sectionName) try { - return block() + block.run() } finally { - endSection(sectionName) + endSection(tag) } }