From 600a2b92c684b779db5bb7ee8f56f60d4cb197ac Mon Sep 17 00:00:00 2001 From: Peng Jiang Date: Thu, 3 Oct 2024 08:42:49 -0700 Subject: [PATCH] remove not needed trace class and setup (#1021) Summary: Pull Request resolved: https://github.com/facebook/litho/pull/1021 we have removed the compose sample from the sample, but not remove the tracer part, so OSS not be abled to built, this will fix it. Reviewed By: apowolny Differential Revision: D63835512 fbshipit-source-id: c33f7cc82e5cd8433602960c51d6193d2837d26f --- .../facebook/samples/litho/ComposeTracer.kt | 48 ------------------- .../samples/litho/LithoSampleApplication.java | 1 - 2 files changed, 49 deletions(-) delete mode 100644 sample/src/main/java/com/facebook/samples/litho/ComposeTracer.kt diff --git a/sample/src/main/java/com/facebook/samples/litho/ComposeTracer.kt b/sample/src/main/java/com/facebook/samples/litho/ComposeTracer.kt deleted file mode 100644 index b6c20719e0d..00000000000 --- a/sample/src/main/java/com/facebook/samples/litho/ComposeTracer.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.facebook.samples.litho - -import androidx.compose.runtime.Composer -import androidx.compose.runtime.CompositionTracer -import androidx.compose.runtime.InternalComposeTracingApi -import com.facebook.litho.DefaultComponentsSystrace - -@OptIn(InternalComposeTracingApi::class) -object ComposeTracer { - - private val tracer = DefaultComponentsSystrace() - - private val composeTrace = - object : CompositionTracer { - override fun isTraceInProgress(): Boolean { - return tracer.isTracing() - } - - override fun traceEventEnd() { - tracer.endSection() - } - - override fun traceEventStart(key: Int, dirty1: Int, dirty2: Int, info: String) { - tracer.beginSection(info) - } - } - - @JvmStatic - fun initialize() { - Composer.setTracer(composeTrace) - } -} diff --git a/sample/src/main/java/com/facebook/samples/litho/LithoSampleApplication.java b/sample/src/main/java/com/facebook/samples/litho/LithoSampleApplication.java index b5b38dff8c6..9312cc05606 100644 --- a/sample/src/main/java/com/facebook/samples/litho/LithoSampleApplication.java +++ b/sample/src/main/java/com/facebook/samples/litho/LithoSampleApplication.java @@ -44,7 +44,6 @@ public void onCreate() { Fresco.initialize(this); FrescoVito.initialize(); SoLoader.init(this, false); - ComposeTracer.initialize(); if (FlipperUtils.shouldEnableFlipper(this)) { final FlipperClient client = AndroidFlipperClient.getInstance(this);