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\"", "-DLOG_TAG=\"ReactNativeJNI\"",
"-DWITH_FBSYSTRACE=1", "-DWITH_FBSYSTRACE=1",
"-DWITH_INSPECTOR=1", "-DWITH_INSPECTOR=1",
"-DWITH_JSC_MEMORY_PRESSURE=1",
], ],
soname = "libreactnativejni.$(ext)", soname = "libreactnativejni.$(ext)",
visibility = [ visibility = [

View File

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

View File

@ -170,11 +170,9 @@ const ModuleRegistry &Instance::getModuleRegistry() const {
ModuleRegistry &Instance::getModuleRegistry() { return *moduleRegistry_; } ModuleRegistry &Instance::getModuleRegistry() { return *moduleRegistry_; }
#ifdef WITH_JSC_MEMORY_PRESSURE
void Instance::handleMemoryPressure(int pressureLevel) { void Instance::handleMemoryPressure(int pressureLevel) {
nativeToJsBridge_->handleMemoryPressure(pressureLevel); nativeToJsBridge_->handleMemoryPressure(pressureLevel);
} }
#endif
} // namespace react } // namespace react
} // namespace facebook } // namespace facebook

View File

@ -6,7 +6,6 @@
#include <memory> #include <memory>
#include <cxxreact/NativeToJsBridge.h> #include <cxxreact/NativeToJsBridge.h>
#include <jschelpers/Value.h>
#ifndef RN_EXPORT #ifndef RN_EXPORT
#define RN_EXPORT __attribute__((visibility("default"))) #define RN_EXPORT __attribute__((visibility("default")))
@ -66,9 +65,7 @@ public:
const ModuleRegistry &getModuleRegistry() const; const ModuleRegistry &getModuleRegistry() const;
ModuleRegistry &getModuleRegistry(); ModuleRegistry &getModuleRegistry();
#ifdef WITH_JSC_MEMORY_PRESSURE
void handleMemoryPressure(int pressureLevel); void handleMemoryPressure(int pressureLevel);
#endif
private: private:
void callNativeModules(folly::dynamic &&calls, bool isEndOfBatch); void callNativeModules(folly::dynamic &&calls, bool isEndOfBatch);

View File

@ -696,12 +696,12 @@ bool JSCExecutor::isInspectable() {
return canUseInspector(m_context); return canUseInspector(m_context);
} }
#ifdef WITH_JSC_MEMORY_PRESSURE
void JSCExecutor::handleMemoryPressure(int pressureLevel) { void JSCExecutor::handleMemoryPressure(int pressureLevel) {
#ifdef WITH_JSC_MEMORY_PRESSURE
JSHandleMemoryPressure( JSHandleMemoryPressure(
this, m_context, static_cast<JSMemoryPressure>(pressureLevel)); this, m_context, static_cast<JSMemoryPressure>(pressureLevel));
}
#endif #endif
}
void JSCExecutor::flushQueueImmediate(Value&& queue) { void JSCExecutor::flushQueueImmediate(Value&& queue) {
auto queueStr = queue.toJSONString(); auto queueStr = queue.toJSONString();

View File

@ -89,9 +89,7 @@ public:
virtual bool isInspectable() override; virtual bool isInspectable() override;
#ifdef WITH_JSC_MEMORY_PRESSURE
virtual void handleMemoryPressure(int pressureLevel) override; virtual void handleMemoryPressure(int pressureLevel) override;
#endif
virtual void destroy() override; virtual void destroy() override;

View File

@ -11,6 +11,7 @@
#include "SystraceSection.h" #include "SystraceSection.h"
#include "MethodCall.h" #include "MethodCall.h"
#include "MessageQueueThread.h" #include "MessageQueueThread.h"
#include "ModuleRegistry.h"
#include "RAMBundleRegistry.h" #include "RAMBundleRegistry.h"
#ifdef WITH_FBSYSTRACE #ifdef WITH_FBSYSTRACE
@ -194,13 +195,11 @@ bool NativeToJsBridge::isInspectable() {
return m_executor->isInspectable(); return m_executor->isInspectable();
} }
#ifdef WITH_JSC_MEMORY_PRESSURE
void NativeToJsBridge::handleMemoryPressure(int pressureLevel) { void NativeToJsBridge::handleMemoryPressure(int pressureLevel) {
runOnExecutorQueue([=] (JSExecutor* executor) { runOnExecutorQueue([=] (JSExecutor* executor) {
executor->handleMemoryPressure(pressureLevel); executor->handleMemoryPressure(pressureLevel);
}); });
} }
#endif
void NativeToJsBridge::destroy() { void NativeToJsBridge::destroy() {
// All calls made through runOnExecutorQueue have an early exit if // All calls made through runOnExecutorQueue have an early exit if

View File

@ -7,7 +7,6 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <cxxreact/JSCExecutor.h>
#include <cxxreact/JSExecutor.h> #include <cxxreact/JSExecutor.h>
namespace folly { namespace folly {
@ -74,9 +73,7 @@ public:
void* getJavaScriptContext(); void* getJavaScriptContext();
bool isInspectable(); bool isInspectable();
#ifdef WITH_JSC_MEMORY_PRESSURE
void handleMemoryPressure(int pressureLevel); void handleMemoryPressure(int pressureLevel);
#endif
/** /**
* Synchronously tears down the bridge and the main executor. * Synchronously tears down the bridge and the main executor.