simplify handleMemoryPressure conditionalization, delete some dead code
Reviewed By: javache Differential Revision: D7803912 fbshipit-source-id: 0bab4be07fc006a208caa75f94b5716c99b5d265
This commit is contained in:
parent
09f3d7ab49
commit
042449f24a
|
@ -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 = [
|
||||
|
|
|
@ -259,9 +259,7 @@ jlong CatalystInstanceImpl::getJavaScriptContext() {
|
|||
}
|
||||
|
||||
void CatalystInstanceImpl::handleMemoryPressure(int pressureLevel) {
|
||||
#ifdef WITH_JSC_MEMORY_PRESSURE
|
||||
instance_->handleMemoryPressure(pressureLevel);
|
||||
#endif
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <memory>
|
||||
|
||||
#include <cxxreact/NativeToJsBridge.h>
|
||||
#include <jschelpers/Value.h>
|
||||
|
||||
#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);
|
||||
|
|
|
@ -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<JSMemoryPressure>(pressureLevel));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void JSCExecutor::flushQueueImmediate(Value&& queue) {
|
||||
auto queueStr = queue.toJSONString();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <cxxreact/JSCExecutor.h>
|
||||
#include <cxxreact/JSExecutor.h>
|
||||
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue