From f7185715df268d3098a134d976ac6a83adcfb54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Thu, 31 Jul 2025 14:29:24 -0700 Subject: [PATCH] Remove unnecessary collectEvents method from PerformanceTracer (#52936) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52936 Changelog: [internal] This method is unused and we're no longer planning to use it. Reviewed By: hoxyq Differential Revision: D79271691 fbshipit-source-id: 1a0be464928a199cfe4a57cb5c44255b127264c2 --- .../tracing/PerformanceTracer.cpp | 30 ------------------- .../tracing/PerformanceTracer.h | 6 ---- 2 files changed, 36 deletions(-) diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.cpp index e287b6f584d..f23c7725382 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.cpp @@ -101,36 +101,6 @@ void PerformanceTracer::collectEvents( } } -folly::dynamic PerformanceTracer::collectEvents(uint16_t chunkSize) { - std::vector localBuffer; - { - std::lock_guard lock(mutex_); - buffer_.swap(localBuffer); - } - - auto chunks = folly::dynamic::array(); - if (localBuffer.empty()) { - return chunks; - } - - auto chunk = folly::dynamic::array(); - chunk.reserve(chunkSize); - for (auto&& event : localBuffer) { - chunk.push_back(TraceEventSerializer::serialize(std::move(event))); - - if (chunk.size() == chunkSize) { - chunks.push_back(std::move(chunk)); - chunk = folly::dynamic::array(); - chunk.reserve(chunkSize); - } - } - - if (!chunk.empty()) { - chunks.push_back(std::move(chunk)); - } - return chunks; -} - std::vector PerformanceTracer::collectTraceEvents() { std::vector events; { diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.h b/packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.h index 088f98a7758..530dce0d44f 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.h @@ -59,12 +59,6 @@ class PerformanceTracer { const std::function& resultCallback, uint16_t chunkSize); - /** - * Flush out buffered CDP Trace Events into a folly::dynamic collection of - * chunks, which can be sent over CDP later. - */ - folly::dynamic collectEvents(uint16_t chunkSize); - /** * Transfers an ownership of all buffered TraceEvents, the local buffer state * is invalidated after this call.