From 767d217818d045289a5dd0c3b85fb1dc2d9284b2 Mon Sep 17 00:00:00 2001 From: maciej simka Date: Wed, 22 Jan 2020 14:39:35 +0100 Subject: [PATCH 1/5] feat: split loadApplicationScript into initializeRuntime and loadBundle --- React/CxxBridge/RCTCxxBridge.mm | 2 +- React/CxxBridge/RCTObjcExecutor.mm | 6 ++++- .../facebook/react/bridge/JavaJSExecutor.java | 2 +- .../react/bridge/ReactMarkerConstants.java | 4 +-- .../devsupport/JSDebuggerWebSocketClient.java | 2 +- .../WebsocketJavaScriptExecutor.java | 6 ++--- .../src/main/jni/react/jni/JReactMarker.cpp | 4 +-- .../src/main/jni/react/jni/ProxyExecutor.cpp | 15 ++++++----- .../src/main/jni/react/jni/ProxyExecutor.h | 3 ++- .../JSDebuggerWebSocketClientTest.java | 4 +-- ReactCommon/cxxreact/Instance.cpp | 25 ++++++++++--------- ReactCommon/cxxreact/Instance.h | 6 +++-- ReactCommon/cxxreact/JSExecutor.h | 6 ++++- ReactCommon/cxxreact/NativeToJsBridge.cpp | 15 ++++++++--- ReactCommon/cxxreact/NativeToJsBridge.h | 11 +++++--- .../jsiexecutor/jsireact/JSIExecutor.cpp | 22 ++++++++++------ .../jsiexecutor/jsireact/JSIExecutor.h | 3 ++- 17 files changed, 85 insertions(+), 51 deletions(-) diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 29d86e144d0edf..69f9d248dd6fc8 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -1336,7 +1336,7 @@ - (void)executeApplicationScript:(NSData *)script self->_reactInstance->loadScriptFromString(std::make_unique(script), sourceUrlStr.UTF8String, !async); } else { - std::string methodName = async ? "loadApplicationScript" : "loadApplicationScriptSync"; + std::string methodName = async ? "loadBundle" : "loadBundleSync"; throw std::logic_error("Attempt to call " + methodName + ": on uninitialized bridge"); } }]; diff --git a/React/CxxBridge/RCTObjcExecutor.mm b/React/CxxBridge/RCTObjcExecutor.mm index ead98eb7fd0402..7c4da26bf71d46 100644 --- a/React/CxxBridge/RCTObjcExecutor.mm +++ b/React/CxxBridge/RCTObjcExecutor.mm @@ -74,7 +74,11 @@ std::make_unique(folly::toJson(config))); } - void loadApplicationScript( + void initializeRuntime() { + // We do nothing here since initialization is done in the constructor + } + + void loadBundle( std::unique_ptr script, std::string sourceURL) override { RCTProfileBeginFlowEvent(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaJSExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaJSExecutor.java index b9572f64ce3eb1..db9f29b130e7fa 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaJSExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaJSExecutor.java @@ -38,7 +38,7 @@ public ProxyExecutorException(Throwable cause) { * @param sourceURL url or file location from which script content was loaded */ @DoNotStrip - void loadApplicationScript(String sourceURL) throws ProxyExecutorException; + void loadBundle(String sourceURL) throws ProxyExecutorException; /** * Execute javascript method within js context diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java index dd08b9a8eea480..5eecfd55af2fd5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java @@ -59,8 +59,8 @@ public enum ReactMarkerConstants { UNPACKING_JS_BUNDLE_LOADER_CHECK_END, UNPACKING_JS_BUNDLE_LOADER_EXTRACTED, UNPACKING_JS_BUNDLE_LOADER_BLOCKED, - loadApplicationScript_startStringConvert, - loadApplicationScript_endStringConvert, + loadBundle_startStringConvert, + loadBundle_endStringConvert, PRE_SETUP_REACT_CONTEXT_START, PRE_SETUP_REACT_CONTEXT_END, PRE_RUN_JS_BUNDLE_START, diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDebuggerWebSocketClient.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDebuggerWebSocketClient.java index 22729b34d78777..66ad0e9acfe55e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDebuggerWebSocketClient.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDebuggerWebSocketClient.java @@ -81,7 +81,7 @@ public void prepareJSRuntime(JSDebuggerCallback callback) { } } - public void loadApplicationScript( + public void loadBundle( String sourceURL, HashMap injectedObjects, JSDebuggerCallback callback) { int requestID = mRequestID.getAndIncrement(); mCallbacks.put(requestID, callback); diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/WebsocketJavaScriptExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/WebsocketJavaScriptExecutor.java index b045cf69f48b04..4102841065c646 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/WebsocketJavaScriptExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/WebsocketJavaScriptExecutor.java @@ -153,10 +153,10 @@ public void close() { } @Override - public void loadApplicationScript(String sourceURL) throws JavaJSExecutor.ProxyExecutorException { + public void loadBundle(String sourceURL) throws JavaJSExecutor.ProxyExecutorException { JSExecutorCallbackFuture callback = new JSExecutorCallbackFuture(); Assertions.assertNotNull(mWebSocketClient) - .loadApplicationScript(sourceURL, mInjectedObjects, callback); + .loadBundle(sourceURL, mInjectedObjects, callback); try { callback.get(); } catch (Throwable cause) { @@ -178,7 +178,7 @@ public void loadApplicationScript(String sourceURL) throws JavaJSExecutor.ProxyE @Override public void setGlobalVariable(String propertyName, String jsonEncodedValue) { - // Store and use in the next loadApplicationScript() call. + // Store and use in the next loadBundle() call. mInjectedObjects.put(propertyName, jsonEncodedValue); } } diff --git a/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp b/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp index 7409681e1a4295..a67463c44da079 100644 --- a/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp @@ -49,10 +49,10 @@ void JReactMarker::logPerfMarker( JReactMarker::logMarker("CREATE_REACT_CONTEXT_END"); break; case ReactMarker::JS_BUNDLE_STRING_CONVERT_START: - JReactMarker::logMarker("loadApplicationScript_startStringConvert"); + JReactMarker::logMarker("loadBundle_startStringConvert"); break; case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP: - JReactMarker::logMarker("loadApplicationScript_endStringConvert"); + JReactMarker::logMarker("loadBundle_endStringConvert"); break; case ReactMarker::NATIVE_MODULE_SETUP_START: JReactMarker::logMarker("NATIVE_MODULE_SETUP_START", tag); diff --git a/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.cpp b/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.cpp index 43914cadd2f48c..37179ba5372fdf 100644 --- a/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.cpp +++ b/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.cpp @@ -53,9 +53,7 @@ ProxyExecutor::~ProxyExecutor() { m_executor.reset(); } -void ProxyExecutor::loadApplicationScript( - std::unique_ptr, - std::string sourceURL) { +void ProxyExecutor::initializeRuntime() { folly::dynamic nativeModuleConfig = folly::dynamic::array; { @@ -76,14 +74,19 @@ void ProxyExecutor::loadApplicationScript( "__fbBatchedBridgeConfig", std::make_unique(folly::toJson(config))); } +} + +void ProxyExecutor::loadBundle( + std::unique_ptr, + std::string sourceURL) { - static auto loadApplicationScript = + static auto loadBundle = jni::findClassStatic(EXECUTOR_BASECLASS) - ->getMethod("loadApplicationScript"); + ->getMethod("loadBundle"); // The proxy ignores the script data passed in. - loadApplicationScript(m_executor.get(), jni::make_jstring(sourceURL).get()); + loadBundle(m_executor.get(), jni::make_jstring(sourceURL).get()); // We can get pending calls here to native but the queue will be drained when // we launch the application. } diff --git a/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h b/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h index fa1c12634fcfbd..c9eab4170d41f4 100644 --- a/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h +++ b/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h @@ -37,7 +37,8 @@ class ProxyExecutor : public JSExecutor { jni::global_ref &&executorInstance, std::shared_ptr delegate); virtual ~ProxyExecutor() override; - virtual void loadApplicationScript( + virtual void initializeRuntime() override; + virtual void loadBundle( std::unique_ptr script, std::string sourceURL) override; virtual void setBundleRegistry( diff --git a/ReactAndroid/src/test/java/com/facebook/react/devsupport/JSDebuggerWebSocketClientTest.java b/ReactAndroid/src/test/java/com/facebook/react/devsupport/JSDebuggerWebSocketClientTest.java index 3a341c7136880e..0c6bbde0e8bdd0 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/devsupport/JSDebuggerWebSocketClientTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/devsupport/JSDebuggerWebSocketClientTest.java @@ -40,7 +40,7 @@ public void test_prepareJSRuntime_ShouldSendCorrectMessage() throws Exception { } @Test - public void test_loadApplicationScript_ShouldSendCorrectMessage() throws Exception { + public void test_loadBundle_ShouldSendCorrectMessage() throws Exception { final JSDebuggerWebSocketClient.JSDebuggerCallback cb = PowerMockito.mock(JSDebuggerWebSocketClient.JSDebuggerCallback.class); @@ -49,7 +49,7 @@ public void test_loadApplicationScript_ShouldSendCorrectMessage() throws Excepti injectedObjects.put("key1", "value1"); injectedObjects.put("key2", "value2"); - client.loadApplicationScript("http://localhost:8080/index.js", injectedObjects, cb); + client.loadBundle("http://localhost:8080/index.js", injectedObjects, cb); PowerMockito.verifyPrivate(client) .invoke( "sendMessage", diff --git a/ReactCommon/cxxreact/Instance.cpp b/ReactCommon/cxxreact/Instance.cpp index 65f1ce171d5925..556208b0f0dba0 100644 --- a/ReactCommon/cxxreact/Instance.cpp +++ b/ReactCommon/cxxreact/Instance.cpp @@ -48,7 +48,8 @@ void Instance::initializeBridge( jsQueue->runOnQueueSync([this, &jsef, jsQueue]() mutable { nativeToJsBridge_ = std::make_unique( jsef.get(), moduleRegistry_, jsQueue, callback_); - + // TODO investigate why it has to be async + nativeToJsBridge_->initializeRuntime(); std::lock_guard lock(m_syncMutex); m_syncReady = true; m_syncCV.notify_all(); @@ -57,25 +58,25 @@ void Instance::initializeBridge( CHECK(nativeToJsBridge_); } -void Instance::loadApplication( +void Instance::loadBundle( std::unique_ptr bundleRegistry, std::unique_ptr string, std::string sourceURL) { callback_->incrementPendingJSCalls(); - SystraceSection s("Instance::loadApplication", "sourceURL", sourceURL); - nativeToJsBridge_->loadApplication( + SystraceSection s("Instance::loadBundle", "sourceURL", sourceURL); + nativeToJsBridge_->loadBundle( std::move(bundleRegistry), std::move(string), std::move(sourceURL)); } -void Instance::loadApplicationSync( +void Instance::loadBundleSync( std::unique_ptr bundleRegistry, std::unique_ptr string, std::string sourceURL) { std::unique_lock lock(m_syncMutex); m_syncCV.wait(lock, [this] { return m_syncReady; }); - SystraceSection s("Instance::loadApplicationSync", "sourceURL", sourceURL); - nativeToJsBridge_->loadApplicationSync( + SystraceSection s("Instance::loadBundleSync", "sourceURL", sourceURL); + nativeToJsBridge_->loadBundleSync( std::move(bundleRegistry), std::move(string), std::move(sourceURL)); } @@ -83,7 +84,7 @@ void Instance::setSourceURL(std::string sourceURL) { callback_->incrementPendingJSCalls(); SystraceSection s("Instance::setSourceURL", "sourceURL", sourceURL); - nativeToJsBridge_->loadApplication(nullptr, nullptr, std::move(sourceURL)); + nativeToJsBridge_->loadBundle(nullptr, nullptr, std::move(sourceURL)); } void Instance::loadScriptFromString( @@ -92,9 +93,9 @@ void Instance::loadScriptFromString( bool loadSynchronously) { SystraceSection s("Instance::loadScriptFromString", "sourceURL", sourceURL); if (loadSynchronously) { - loadApplicationSync(nullptr, std::move(string), std::move(sourceURL)); + loadBundleSync(nullptr, std::move(string), std::move(sourceURL)); } else { - loadApplication(nullptr, std::move(string), std::move(sourceURL)); + loadBundle(nullptr, std::move(string), std::move(sourceURL)); } } @@ -150,12 +151,12 @@ void Instance::loadRAMBundle( std::string startupScriptSourceURL, bool loadSynchronously) { if (loadSynchronously) { - loadApplicationSync( + loadBundleSync( std::move(bundleRegistry), std::move(startupScript), std::move(startupScriptSourceURL)); } else { - loadApplication( + loadBundle( std::move(bundleRegistry), std::move(startupScript), std::move(startupScriptSourceURL)); diff --git a/ReactCommon/cxxreact/Instance.h b/ReactCommon/cxxreact/Instance.h index f7b9a7f19697c6..4dc0b6737af23b 100644 --- a/ReactCommon/cxxreact/Instance.h +++ b/ReactCommon/cxxreact/Instance.h @@ -44,6 +44,8 @@ class RN_EXPORT Instance { std::shared_ptr jsQueue, std::shared_ptr moduleRegistry); + void initializeRuntime(); + void setSourceURL(std::string sourceURL); void loadScriptFromString(std::unique_ptr string, @@ -79,10 +81,10 @@ class RN_EXPORT Instance { private: void callNativeModules(folly::dynamic &&calls, bool isEndOfBatch); - void loadApplication(std::unique_ptr bundleRegistry, + void loadBundle(std::unique_ptr bundleRegistry, std::unique_ptr startupScript, std::string startupScriptSourceURL); - void loadApplicationSync(std::unique_ptr bundleRegistry, + void loadBundleSync(std::unique_ptr bundleRegistry, std::unique_ptr startupScript, std::string startupScriptSourceURL); diff --git a/ReactCommon/cxxreact/JSExecutor.h b/ReactCommon/cxxreact/JSExecutor.h index fe1dc1b1175625..a70bd9e2eb0944 100644 --- a/ReactCommon/cxxreact/JSExecutor.h +++ b/ReactCommon/cxxreact/JSExecutor.h @@ -53,10 +53,14 @@ class JSExecutorFactory { class RN_EXPORT JSExecutor { public: + /** + * Sets all globals in the JS context. + */ + virtual void initializeRuntime() = 0; /** * Execute an application script bundle in the JS context. */ - virtual void loadApplicationScript(std::unique_ptr script, + virtual void loadBundle(std::unique_ptr script, std::string sourceURL) = 0; /** diff --git a/ReactCommon/cxxreact/NativeToJsBridge.cpp b/ReactCommon/cxxreact/NativeToJsBridge.cpp index 0e34f942a858c6..2a9dce0d2e0f0a 100644 --- a/ReactCommon/cxxreact/NativeToJsBridge.cpp +++ b/ReactCommon/cxxreact/NativeToJsBridge.cpp @@ -108,7 +108,14 @@ NativeToJsBridge::~NativeToJsBridge() { << "NativeToJsBridge::destroy() must be called before deallocating the NativeToJsBridge!"; } -void NativeToJsBridge::loadApplication( +void NativeToJsBridge::initializeRuntime() { + runOnExecutorQueue([] + (JSExecutor* executor) mutable { + executor->initializeRuntime(); + }); +} + +void NativeToJsBridge::loadBundle( std::unique_ptr bundleRegistry, std::unique_ptr startupScript, std::string startupScriptSourceURL) { @@ -123,7 +130,7 @@ void NativeToJsBridge::loadApplication( executor->setBundleRegistry(std::move(bundleRegistry)); } try { - executor->loadApplicationScript( + executor->loadBundle( std::move(*startupScript), std::move(startupScriptSourceURL)); } catch (...) { m_applicationScriptHasFailure = true; @@ -132,7 +139,7 @@ void NativeToJsBridge::loadApplication( }); } -void NativeToJsBridge::loadApplicationSync( +void NativeToJsBridge::loadBundleSync( std::unique_ptr bundleRegistry, std::unique_ptr startupScript, std::string startupScriptSourceURL) { @@ -140,7 +147,7 @@ void NativeToJsBridge::loadApplicationSync( m_executor->setBundleRegistry(std::move(bundleRegistry)); } try { - m_executor->loadApplicationScript( + m_executor->loadBundle( std::move(startupScript), std::move(startupScriptSourceURL)); } catch (...) { m_applicationScriptHasFailure = true; diff --git a/ReactCommon/cxxreact/NativeToJsBridge.h b/ReactCommon/cxxreact/NativeToJsBridge.h index aa0c569b214f90..46837f38bdd88a 100644 --- a/ReactCommon/cxxreact/NativeToJsBridge.h +++ b/ReactCommon/cxxreact/NativeToJsBridge.h @@ -31,7 +31,7 @@ class RAMBundleRegistry; // executors and their threads. All functions here can be called from // any thread. // -// Except for loadApplicationScriptSync(), all void methods will queue +// Except for loadBundleSync(), all void methods will queue // work to run on the jsQueue passed to the ctor, and return // immediately. class NativeToJsBridge { @@ -59,16 +59,21 @@ class NativeToJsBridge { */ void invokeCallback(double callbackId, folly::dynamic&& args); + /** + * Sets global variables in the JS Context. + */ + void initializeRuntime(); + /** * Starts the JS application. If bundleRegistry is non-null, then it is * used to fetch JavaScript modules as individual scripts. * Otherwise, the script is assumed to include all the modules. */ - void loadApplication( + void loadBundle( std::unique_ptr bundleRegistry, std::unique_ptr startupCode, std::string sourceURL); - void loadApplicationSync( + void loadBundleSync( std::unique_ptr bundleRegistry, std::unique_ptr startupCode, std::string sourceURL); diff --git a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp index eaf7b71bc91bef..b8bb4191a0b0cd 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +++ b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp @@ -69,13 +69,8 @@ JSIExecutor::JSIExecutor( *runtime, "__jsiExecutorDescription", runtime->description()); } -void JSIExecutor::loadApplicationScript( - std::unique_ptr script, - std::string sourceURL) { - SystraceSection s("JSIExecutor::loadApplicationScript"); - - // TODO: check for and use precompiled HBC - +void JSIExecutor::initializeRuntime() { + SystraceSection s("JSIExecutor::initializeRuntime"); runtime_->global().setProperty( *runtime_, "nativeModuleProxy", @@ -133,6 +128,18 @@ void JSIExecutor::loadApplicationScript( if (runtimeInstaller_) { runtimeInstaller_(*runtime_); } + bool hasLogger(ReactMarker::logTaggedMarker); + if (hasLogger) { + ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP); + } +} + +void JSIExecutor::loadBundle( + std::unique_ptr script, + std::string sourceURL) { + SystraceSection s("JSIExecutor::loadBundle"); + + // TODO: check for and use precompiled HBC bool hasLogger(ReactMarker::logTaggedMarker); std::string scriptName = simpleBasename(sourceURL); @@ -144,7 +151,6 @@ void JSIExecutor::loadApplicationScript( std::make_unique(std::move(script)), sourceURL); flush(); if (hasLogger) { - ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP); ReactMarker::logTaggedMarker( ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str()); } diff --git a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h index cb4a7290f640db..ccc7360e9e985c 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h +++ b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h @@ -77,7 +77,8 @@ class JSIExecutor : public JSExecutor { std::shared_ptr delegate, const JSIScopedTimeoutInvoker &timeoutInvoker, RuntimeInstaller runtimeInstaller); - void loadApplicationScript( + void initializeRuntime() override; + void loadBundle( std::unique_ptr script, std::string sourceURL) override; void setBundleRegistry(std::unique_ptr) override; From e830054cbf9d330aa7eb2296eaca017e3f3eaf64 Mon Sep 17 00:00:00 2001 From: maciej simka Date: Tue, 11 Feb 2020 11:49:58 +0100 Subject: [PATCH 2/5] improve JSExecutor comment --- ReactCommon/cxxreact/JSExecutor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ReactCommon/cxxreact/JSExecutor.h b/ReactCommon/cxxreact/JSExecutor.h index a70bd9e2eb0944..f7849808461427 100644 --- a/ReactCommon/cxxreact/JSExecutor.h +++ b/ReactCommon/cxxreact/JSExecutor.h @@ -54,7 +54,8 @@ class JSExecutorFactory { class RN_EXPORT JSExecutor { public: /** - * Sets all globals in the JS context. + * Prepares the JS runtime for React Native by installing global variables. + * Called once before any JS is evaluated. */ virtual void initializeRuntime() = 0; /** From 9f61ca248d7e6de55cf47188fc2c34ba252867a4 Mon Sep 17 00:00:00 2001 From: maciej simka Date: Tue, 11 Feb 2020 11:53:21 +0100 Subject: [PATCH 3/5] revert perf markers naming change --- .../java/com/facebook/react/bridge/ReactMarkerConstants.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java index 5eecfd55af2fd5..dd08b9a8eea480 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java @@ -59,8 +59,8 @@ public enum ReactMarkerConstants { UNPACKING_JS_BUNDLE_LOADER_CHECK_END, UNPACKING_JS_BUNDLE_LOADER_EXTRACTED, UNPACKING_JS_BUNDLE_LOADER_BLOCKED, - loadBundle_startStringConvert, - loadBundle_endStringConvert, + loadApplicationScript_startStringConvert, + loadApplicationScript_endStringConvert, PRE_SETUP_REACT_CONTEXT_START, PRE_SETUP_REACT_CONTEXT_END, PRE_RUN_JS_BUNDLE_START, From 5951351d0205de0876864822ca868eb596a3529d Mon Sep 17 00:00:00 2001 From: maciej simka Date: Tue, 11 Feb 2020 12:38:07 +0100 Subject: [PATCH 4/5] remove unnecessary comment --- ReactCommon/cxxreact/Instance.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ReactCommon/cxxreact/Instance.cpp b/ReactCommon/cxxreact/Instance.cpp index 556208b0f0dba0..7369c497c7c8cf 100644 --- a/ReactCommon/cxxreact/Instance.cpp +++ b/ReactCommon/cxxreact/Instance.cpp @@ -48,7 +48,6 @@ void Instance::initializeBridge( jsQueue->runOnQueueSync([this, &jsef, jsQueue]() mutable { nativeToJsBridge_ = std::make_unique( jsef.get(), moduleRegistry_, jsQueue, callback_); - // TODO investigate why it has to be async nativeToJsBridge_->initializeRuntime(); std::lock_guard lock(m_syncMutex); m_syncReady = true; From d95a874a98a15a3b8cab2b26594143e1e70cc1b3 Mon Sep 17 00:00:00 2001 From: maciej simka Date: Thu, 13 Feb 2020 09:42:36 +0100 Subject: [PATCH 5/5] revert marker changes in JReactMarker --- ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp b/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp index a67463c44da079..7409681e1a4295 100644 --- a/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp @@ -49,10 +49,10 @@ void JReactMarker::logPerfMarker( JReactMarker::logMarker("CREATE_REACT_CONTEXT_END"); break; case ReactMarker::JS_BUNDLE_STRING_CONVERT_START: - JReactMarker::logMarker("loadBundle_startStringConvert"); + JReactMarker::logMarker("loadApplicationScript_startStringConvert"); break; case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP: - JReactMarker::logMarker("loadBundle_endStringConvert"); + JReactMarker::logMarker("loadApplicationScript_endStringConvert"); break; case ReactMarker::NATIVE_MODULE_SETUP_START: JReactMarker::logMarker("NATIVE_MODULE_SETUP_START", tag);