Skip to content

Commit 6150ccf

Browse files
huntiefacebook-github-bot
authored andcommitted
Refactor performanceNow call, remove cxxreact dependency (#51024)
Summary: Pull Request resolved: #51024 Prevents a dependency cycle in the next diff. Changelog: [Internal] Reviewed By: hoxyq Differential Revision: D73933671
1 parent bcff19d commit 6150ccf

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

packages/react-native/ReactCommon/react/performance/timeline/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ target_include_directories(react_performance_timeline PUBLIC ${REACT_COMMON_DIR}
1818
target_link_libraries(react_performance_timeline
1919
jsinspector_tracing
2020
reactperflogger
21-
react_timing
22-
react_cxxreact)
21+
react_timing)

packages/react-native/ReactCommon/react/performance/timeline/PerformanceEntryReporter.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
#include "PerformanceEntryReporter.h"
99

10-
#include <cxxreact/JSExecutor.h>
1110
#include <jsinspector-modern/tracing/PerformanceTracer.h>
1211
#include <react/featureflags/ReactNativeFeatureFlags.h>
12+
#include <react/timing/primitives.h>
1313
#include <reactperflogger/ReactPerfettoLogger.h>
1414

1515
#ifdef WITH_PERFETTO
@@ -37,6 +37,10 @@ uint64_t timestampToMicroseconds(DOMHighResTimeStamp timestamp) {
3737
return static_cast<uint64_t>(timestamp * 1000);
3838
}
3939

40+
double performanceNow() {
41+
return chronoToDOMHighResTimeStamp(std::chrono::steady_clock::now());
42+
}
43+
4044
#if defined(__clang__)
4145
#define NO_DESTROY [[clang::no_destroy]]
4246
#else
@@ -81,7 +85,7 @@ PerformanceEntryReporter::PerformanceEntryReporter()
8185

8286
DOMHighResTimeStamp PerformanceEntryReporter::getCurrentTimeStamp() const {
8387
return timeStampProvider_ != nullptr ? timeStampProvider_()
84-
: JSExecutor::performanceNow();
88+
: performanceNow();
8589
}
8690

8791
std::vector<PerformanceEntryType>

packages/react-native/ReactCommon/react/performance/timeline/React-performancetimeline.podspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ Pod::Spec.new do |s|
4646
s.dependency "React-featureflags"
4747
add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
4848
s.dependency "React-timing"
49-
s.dependency "React-cxxreact"
5049
s.dependency "React-perflogger"
5150

5251
add_rn_third_party_dependencies(s)

0 commit comments

Comments
 (0)