Skip to content

Commit cbfa2ec

Browse files
Jiawei Lüfacebook-github-bot
authored andcommitted
Revert D75006354: Remove JSExecutor::performanceNow()
Differential Revision: D75006354 Original commit changeset: d41bf73238e9 Original Phabricator Diff: D75006354 fbshipit-source-id: 99c60268d8d829ff87a8486b0ca67a47bfb198b4
1 parent 1eebb5a commit cbfa2ec

6 files changed

Lines changed: 11 additions & 5 deletions

File tree

packages/react-native/ReactCommon/cxxreact/JSExecutor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ std::string JSExecutor::getSyntheticBundlePath(
2727
return buffer.data();
2828
}
2929

30+
HighResTimeStamp JSExecutor::performanceNow() {
31+
return HighResTimeStamp::now();
32+
}
33+
3034
jsinspector_modern::RuntimeTargetDelegate&
3135
JSExecutor::getRuntimeTargetDelegate() {
3236
if (!runtimeTargetDelegate_) {

packages/react-native/ReactCommon/cxxreact/JSExecutor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ class RN_EXPORT JSExecutor {
139139
uint32_t bundleId,
140140
const std::string& bundlePath);
141141

142+
static HighResTimeStamp performanceNow();
143+
142144
/**
143145
* Get a reference to the \c RuntimeTargetDelegate owned (or implemented) by
144146
* this executor. This reference must remain valid for the duration of the

packages/react-native/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ void bindNativePerformanceNow(Runtime& runtime) {
557557
const jsi::Value&,
558558
const jsi::Value* args,
559559
size_t /*count*/) {
560-
return HighResTimeStamp::now().toDOMHighResTimeStamp();
560+
return JSExecutor::performanceNow().toDOMHighResTimeStamp();
561561
}));
562562
}
563563

packages/react-native/ReactCommon/react/nativemodule/webperformance/NativePerformance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ NativePerformance::NativePerformance(std::shared_ptr<CallInvoker> jsInvoker)
117117
: NativePerformanceCxxSpec(std::move(jsInvoker)) {}
118118

119119
HighResTimeStamp NativePerformance::now(jsi::Runtime& /*rt*/) {
120-
return HighResTimeStamp::now();
120+
return JSExecutor::performanceNow();
121121
}
122122

123123
HighResTimeStamp NativePerformance::markWithResult(

packages/react-native/ReactCommon/react/renderer/observers/intersection/IntersectionObserverManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void IntersectionObserverManager::observe(
9898

9999
if (!hasPendingTransactions) {
100100
auto entry = observer->updateIntersectionObservation(
101-
*rootShadowNode, HighResTimeStamp::now());
101+
*rootShadowNode, JSExecutor::performanceNow());
102102
if (entry) {
103103
{
104104
std::unique_lock lock(pendingEntriesMutex_);
@@ -266,7 +266,7 @@ void IntersectionObserverManager::updateIntersectionObservations(
266266
}
267267

268268
auto entry = observer->updateIntersectionObservation(
269-
*rootShadowNode, HighResTimeStamp::now());
269+
*rootShadowNode, JSExecutor::performanceNow());
270270
if (entry) {
271271
{
272272
std::unique_lock lock(pendingEntriesMutex_);

packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ void UIManager::shadowTreeDidFinishTransaction(
638638
void UIManager::reportMount(SurfaceId surfaceId) const {
639639
TraceSection s("UIManager::reportMount");
640640

641-
auto time = HighResTimeStamp::now();
641+
auto time = JSExecutor::performanceNow();
642642

643643
auto rootShadowNode = RootShadowNode::Shared{};
644644
shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree& shadowTree) {

0 commit comments

Comments
 (0)