diff --git a/ReactAndroid/src/main/jni/react/jni/BUCK b/ReactAndroid/src/main/jni/react/jni/BUCK index dc0f2a76d..e79a63dbd 100644 --- a/ReactAndroid/src/main/jni/react/jni/BUCK +++ b/ReactAndroid/src/main/jni/react/jni/BUCK @@ -47,7 +47,6 @@ rn_xplat_cxx_library( "-DLOG_TAG=\"ReactNativeJNI\"", "-DWITH_FBSYSTRACE=1", "-DWITH_INSPECTOR=1", - "-DWITH_JSC_MEMORY_PRESSURE=1", ], soname = "libreactnativejni.$(ext)", visibility = [ diff --git a/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp b/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp index aeb4cc55e..0c5cf5c8f 100644 --- a/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp +++ b/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp @@ -259,9 +259,7 @@ jlong CatalystInstanceImpl::getJavaScriptContext() { } void CatalystInstanceImpl::handleMemoryPressure(int pressureLevel) { - #ifdef WITH_JSC_MEMORY_PRESSURE instance_->handleMemoryPressure(pressureLevel); - #endif } }} diff --git a/ReactCommon/cxxreact/Instance.cpp b/ReactCommon/cxxreact/Instance.cpp index c3fd8cf60..534f4b981 100644 --- a/ReactCommon/cxxreact/Instance.cpp +++ b/ReactCommon/cxxreact/Instance.cpp @@ -170,11 +170,9 @@ const ModuleRegistry &Instance::getModuleRegistry() const { ModuleRegistry &Instance::getModuleRegistry() { return *moduleRegistry_; } -#ifdef WITH_JSC_MEMORY_PRESSURE void Instance::handleMemoryPressure(int pressureLevel) { nativeToJsBridge_->handleMemoryPressure(pressureLevel); } -#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/cxxreact/Instance.h b/ReactCommon/cxxreact/Instance.h index e35ce4bbe..dffbe7246 100644 --- a/ReactCommon/cxxreact/Instance.h +++ b/ReactCommon/cxxreact/Instance.h @@ -6,7 +6,6 @@ #include #include -#include #ifndef RN_EXPORT #define RN_EXPORT __attribute__((visibility("default"))) @@ -66,9 +65,7 @@ public: const ModuleRegistry &getModuleRegistry() const; ModuleRegistry &getModuleRegistry(); -#ifdef WITH_JSC_MEMORY_PRESSURE void handleMemoryPressure(int pressureLevel); -#endif private: void callNativeModules(folly::dynamic &&calls, bool isEndOfBatch); diff --git a/ReactCommon/cxxreact/JSCExecutor.cpp b/ReactCommon/cxxreact/JSCExecutor.cpp index c88da5f5b..d20c97a15 100644 --- a/ReactCommon/cxxreact/JSCExecutor.cpp +++ b/ReactCommon/cxxreact/JSCExecutor.cpp @@ -696,12 +696,12 @@ bool JSCExecutor::isInspectable() { return canUseInspector(m_context); } -#ifdef WITH_JSC_MEMORY_PRESSURE void JSCExecutor::handleMemoryPressure(int pressureLevel) { +#ifdef WITH_JSC_MEMORY_PRESSURE JSHandleMemoryPressure( this, m_context, static_cast(pressureLevel)); -} #endif +} void JSCExecutor::flushQueueImmediate(Value&& queue) { auto queueStr = queue.toJSONString(); diff --git a/ReactCommon/cxxreact/JSCExecutor.h b/ReactCommon/cxxreact/JSCExecutor.h index 44b13aa94..b85e590d7 100644 --- a/ReactCommon/cxxreact/JSCExecutor.h +++ b/ReactCommon/cxxreact/JSCExecutor.h @@ -89,9 +89,7 @@ public: virtual bool isInspectable() override; -#ifdef WITH_JSC_MEMORY_PRESSURE virtual void handleMemoryPressure(int pressureLevel) override; -#endif virtual void destroy() override; diff --git a/ReactCommon/cxxreact/NativeToJsBridge.cpp b/ReactCommon/cxxreact/NativeToJsBridge.cpp index f8ae2856e..3cf374f06 100644 --- a/ReactCommon/cxxreact/NativeToJsBridge.cpp +++ b/ReactCommon/cxxreact/NativeToJsBridge.cpp @@ -11,6 +11,7 @@ #include "SystraceSection.h" #include "MethodCall.h" #include "MessageQueueThread.h" +#include "ModuleRegistry.h" #include "RAMBundleRegistry.h" #ifdef WITH_FBSYSTRACE @@ -194,13 +195,11 @@ bool NativeToJsBridge::isInspectable() { return m_executor->isInspectable(); } -#ifdef WITH_JSC_MEMORY_PRESSURE void NativeToJsBridge::handleMemoryPressure(int pressureLevel) { runOnExecutorQueue([=] (JSExecutor* executor) { executor->handleMemoryPressure(pressureLevel); }); } -#endif void NativeToJsBridge::destroy() { // All calls made through runOnExecutorQueue have an early exit if diff --git a/ReactCommon/cxxreact/NativeToJsBridge.h b/ReactCommon/cxxreact/NativeToJsBridge.h index 78d960a08..7e7aaf77e 100644 --- a/ReactCommon/cxxreact/NativeToJsBridge.h +++ b/ReactCommon/cxxreact/NativeToJsBridge.h @@ -7,7 +7,6 @@ #include #include -#include #include namespace folly { @@ -74,9 +73,7 @@ public: void* getJavaScriptContext(); bool isInspectable(); - #ifdef WITH_JSC_MEMORY_PRESSURE void handleMemoryPressure(int pressureLevel); - #endif /** * Synchronously tears down the bridge and the main executor.