mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Move nativePerformanceNow binding call into common core code (#38928)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38928 ## Changelog: [Internal] - This moves the call to bind the `nativePerformanceNow` function to the common place in C++ code (`JSIExecutor::initializeRuntime`), as opposed on relying on calling it from every platform-specific implementation. I believe the reason why it was don this way, to begin with, was historical, since we did use to have a different implementation of this function on every platform. Now we have a common one in C++, anyway, so there is no reason whatsoever to have this binding platform-specific. Reviewed By: rubennorte Differential Revision: D48232883 fbshipit-source-id: 164dc464ab7f89e993d83a4562906e033aabb3b7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
85eb2c95da
commit
6860ffa350
@@ -19,7 +19,6 @@ JSIExecutor::RuntimeInstaller RCTJSIExecutorRuntimeInstaller(JSIExecutor::Runtim
|
||||
_RCTLogJavaScriptInternal(static_cast<RCTLogLevel>(logLevel), [NSString stringWithUTF8String:message.c_str()]);
|
||||
};
|
||||
bindNativeLogger(runtime, iosLoggingBinder);
|
||||
bindNativePerformanceNow(runtime);
|
||||
|
||||
// Wrap over the original runtimeInstaller
|
||||
if (runtimeInstaller) {
|
||||
|
||||
@@ -46,7 +46,6 @@ static void installBindings(jsi::Runtime &runtime) {
|
||||
static_cast<void (*)(const std::string &, unsigned int)>(
|
||||
&reactAndroidLoggingHook);
|
||||
react::bindNativeLogger(runtime, androidLogger);
|
||||
react::bindNativePerformanceNow(runtime);
|
||||
}
|
||||
|
||||
class HermesExecutorHolder
|
||||
|
||||
@@ -29,7 +29,6 @@ class JSCExecutorFactory : public JSExecutorFactory {
|
||||
static_cast<void (*)(const std::string &, unsigned int)>(
|
||||
&reactAndroidLoggingHook);
|
||||
react::bindNativeLogger(runtime, androidLogger);
|
||||
react::bindNativePerformanceNow(runtime);
|
||||
};
|
||||
return std::make_unique<JSIExecutor>(
|
||||
jsc::makeJSCRuntime(),
|
||||
|
||||
@@ -81,6 +81,9 @@ JSIExecutor::JSIExecutor(
|
||||
|
||||
void JSIExecutor::initializeRuntime() {
|
||||
SystraceSection s("JSIExecutor::initializeRuntime");
|
||||
|
||||
bindNativePerformanceNow(*runtime_);
|
||||
|
||||
runtime_->global().setProperty(
|
||||
*runtime_,
|
||||
"nativeModuleProxy",
|
||||
@@ -136,6 +139,7 @@ void JSIExecutor::initializeRuntime() {
|
||||
if (runtimeInstaller_) {
|
||||
runtimeInstaller_(*runtime_);
|
||||
}
|
||||
|
||||
bool hasLogger(ReactMarker::logTaggedMarkerImpl);
|
||||
if (hasLogger) {
|
||||
ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP);
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
|
||||
#include <cxxreact/ErrorUtils.h>
|
||||
#include <cxxreact/JSBigString.h>
|
||||
#include <cxxreact/JSExecutor.h>
|
||||
#include <cxxreact/SystraceSection.h>
|
||||
#include <glog/logging.h>
|
||||
#include <jsi/JSIDynamic.h>
|
||||
#include <jsi/instrumentation.h>
|
||||
#include <jsireact/JSIExecutor.h>
|
||||
#include <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h>
|
||||
|
||||
#include <cxxreact/ReactMarker.h>
|
||||
@@ -339,6 +341,9 @@ void ReactInstance::initializeRuntime(
|
||||
runtimeScheduler_->scheduleWork([this, options, bindingsInstallFunc](
|
||||
jsi::Runtime &runtime) {
|
||||
SystraceSection s("ReactInstance::initializeRuntime");
|
||||
|
||||
bindNativePerformanceNow(runtime);
|
||||
|
||||
RuntimeSchedulerBinding::createAndInstallIfNeeded(
|
||||
runtime, runtimeScheduler_);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user