simplify handleMemoryPressure conditionalization, delete some dead code

Reviewed By: javache

Differential Revision: D7803912

fbshipit-source-id: 0bab4be07fc006a208caa75f94b5716c99b5d265
This commit is contained in:
Marc Horowitz 2018-05-09 22:01:50 -07:00 committed by Facebook Github Bot
parent 09f3d7ab49
commit 042449f24a
8 changed files with 3 additions and 17 deletions

View File

@ -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 = [

View File

@ -259,9 +259,7 @@ jlong CatalystInstanceImpl::getJavaScriptContext() {
}
void CatalystInstanceImpl::handleMemoryPressure(int pressureLevel) {
#ifdef WITH_JSC_MEMORY_PRESSURE
instance_->handleMemoryPressure(pressureLevel);
#endif
}
}}

View File

@ -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

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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

View File

@ -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.