Skip to content

Commit 3426ba1

Browse files
committed
Remove Papa/Safe prefixes from names
We are no longer using papa safe trace, so this commit renames SafeTraceInterface to TraceInterface, PapaSafeTrace to WorkflowTrace, WorkflowPapaTracer to WorkflowTracer, and FakeSafeTrace to FakeTrace to better reflect their purpose without legacy naming conventions. Maintains backward compatibility by keeping deprecated versions of the old class names that delegate to the new implementations. All test files updated to use the new naming convention. workflow-tracing-papa is misleading, but it's the name of a jar published to maven, so I've preserved it.
1 parent 719cd4a commit 3426ba1

File tree

11 files changed

+710
-627
lines changed

11 files changed

+710
-627
lines changed

workflow-tracing-papa/api/workflow-tracing-papa.api

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public final class com/squareup/workflow1/tracing/papa/PapaSafeTrace : com/squareup/workflow1/tracing/SafeTraceInterface {
1+
public final class com/squareup/workflow1/tracing/WorkflowTrace : com/squareup/workflow1/tracing/TraceInterface {
22
public fun <init> ()V
33
public fun <init> (Z)V
44
public synthetic fun <init> (ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
@@ -11,11 +11,11 @@ public final class com/squareup/workflow1/tracing/papa/PapaSafeTrace : com/squar
1111
public fun logSection (Ljava/lang/String;)V
1212
}
1313

14-
public final class com/squareup/workflow1/tracing/papa/WorkflowPapaTracer : com/squareup/workflow1/tracing/WorkflowRuntimeTracer {
15-
public static final field Companion Lcom/squareup/workflow1/tracing/papa/WorkflowPapaTracer$Companion;
14+
public class com/squareup/workflow1/tracing/WorkflowTracer : com/squareup/workflow1/tracing/WorkflowRuntimeTracer {
15+
public static final field Companion Lcom/squareup/workflow1/tracing/WorkflowTracer$Companion;
1616
public fun <init> ()V
17-
public fun <init> (Lcom/squareup/workflow1/tracing/SafeTraceInterface;)V
18-
public synthetic fun <init> (Lcom/squareup/workflow1/tracing/SafeTraceInterface;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
17+
public fun <init> (Lcom/squareup/workflow1/tracing/TraceInterface;)V
18+
public synthetic fun <init> (Lcom/squareup/workflow1/tracing/TraceInterface;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
1919
public fun onInitialState (Ljava/lang/Object;Lcom/squareup/workflow1/Snapshot;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function3;Lcom/squareup/workflow1/WorkflowInterceptor$WorkflowSession;)Ljava/lang/Object;
2020
public fun onPropsChanged (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function3;Lcom/squareup/workflow1/WorkflowInterceptor$WorkflowSession;)Ljava/lang/Object;
2121
public fun onRender (Ljava/lang/Object;Ljava/lang/Object;Lcom/squareup/workflow1/BaseRenderContext;Lkotlin/jvm/functions/Function3;Lcom/squareup/workflow1/WorkflowInterceptor$WorkflowSession;)Ljava/lang/Object;
@@ -27,6 +27,25 @@ public final class com/squareup/workflow1/tracing/papa/WorkflowPapaTracer : com/
2727
public fun onWorkflowSessionStopped (J)V
2828
}
2929

30-
public final class com/squareup/workflow1/tracing/papa/WorkflowPapaTracer$Companion {
30+
public final class com/squareup/workflow1/tracing/WorkflowTracer$Companion {
31+
}
32+
33+
public final class com/squareup/workflow1/tracing/papa/PapaSafeTrace : com/squareup/workflow1/tracing/TraceInterface {
34+
public fun <init> ()V
35+
public fun <init> (Z)V
36+
public synthetic fun <init> (ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
37+
public fun beginAsyncSection (Ljava/lang/String;I)V
38+
public fun beginSection (Ljava/lang/String;)V
39+
public fun endAsyncSection (Ljava/lang/String;I)V
40+
public fun endSection ()V
41+
public fun isCurrentlyTracing ()Z
42+
public fun isTraceable ()Z
43+
public fun logSection (Ljava/lang/String;)V
44+
}
45+
46+
public final class com/squareup/workflow1/tracing/papa/WorkflowPapaTracer : com/squareup/workflow1/tracing/WorkflowTracer {
47+
public fun <init> ()V
48+
public fun <init> (Lcom/squareup/workflow1/tracing/TraceInterface;)V
49+
public synthetic fun <init> (Lcom/squareup/workflow1/tracing/TraceInterface;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
3150
}
3251

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.squareup.workflow1.tracing
2+
3+
import androidx.tracing.Trace
4+
import androidx.tracing.trace
5+
6+
/**
7+
* Production implementation of [TraceInterface] that uses androidx.tracing.Trace.
8+
*
9+
* @param isTraceable Whether tracing is enabled. Clients should configure this directly.
10+
* Defaults to false for backwards compatibility.
11+
*/
12+
class WorkflowTrace(
13+
override val isTraceable: Boolean = false
14+
) : TraceInterface {
15+
16+
override val isCurrentlyTracing: Boolean
17+
get() = Trace.isEnabled()
18+
19+
override fun beginSection(label: String) {
20+
Trace.beginSection(label)
21+
}
22+
23+
override fun endSection() {
24+
Trace.endSection()
25+
}
26+
27+
override fun beginAsyncSection(
28+
name: String,
29+
cookie: Int
30+
) {
31+
Trace.beginAsyncSection(name, cookie)
32+
}
33+
34+
override fun endAsyncSection(
35+
name: String,
36+
cookie: Int
37+
) {
38+
Trace.endAsyncSection(name, cookie)
39+
}
40+
41+
override fun logSection(info: String) {
42+
trace(info) {}
43+
}
44+
}

0 commit comments

Comments
 (0)