Revert D4840716: Refactor interfaces

Differential Revision: D4840716

fbshipit-source-id: 1b6a6050d78ccbbd3c817621df1c1c989594fdb1
This commit is contained in:
Martin Kralik
2017-04-06 05:50:28 -07:00
committed by Facebook Github Bot
parent 77bee75893
commit 5f37483466
11 changed files with 35 additions and 126 deletions

View File

@@ -39,6 +39,7 @@ if THIS_IS_FBANDROID:
'-DWITH_JSC_MEMORY_PRESSURE=1',
'-DWITH_REACT_INTERNAL_SETTINGS=1',
'-DWITH_FB_MEMORY_PROFILING=1',
'-DWITH_INSPECTOR=1',
],
deps = JSC_DEPS,
visibility = [

View File

@@ -18,7 +18,10 @@
#include <jschelpers/JSCHelpers.h>
#include <jschelpers/Value.h>
#include <jschelpers/InspectorInterfaces.h>
#ifdef WITH_INSPECTOR
#include <inspector/Inspector.h>
#endif
#include "JSBundleType.h"
#include "Platform.h"
@@ -217,16 +220,6 @@ void JSCExecutor::setContextName(const std::string& name) {
JSC_JSGlobalContextSetName(m_context, jsName);
}
static bool canUseInspector(JSContextRef context) {
#if defined(__APPLE__)
return isCustomJSCPtr(context);
#elif defined(WITH_FBJSCEXTENSIONS)
return true;
#else
return false;
#endif
}
void JSCExecutor::initOnJSVMThread() throw(JSException) {
SystraceSection s("JSCExecutor.initOnJSVMThread");
@@ -260,10 +253,9 @@ void JSCExecutor::initOnJSVMThread() throw(JSException) {
// Add a pointer to ourselves so we can retrieve it later in our hooks
Object::getGlobalObject(m_context).setPrivate(this);
if (canUseInspector(m_context)) {
IInspector* pInspector = JSC_JSInspectorGetInstance(true);
pInspector->registerGlobalContext("main", m_context);
}
#ifdef WITH_INSPECTOR
Inspector::instance().registerGlobalContext("main", m_context);
#endif
installNativeHook<&JSCExecutor::nativeFlushQueueImmediate>("nativeFlushQueueImmediate");
installNativeHook<&JSCExecutor::nativeCallSyncHook>("nativeCallSyncHook");
@@ -319,10 +311,9 @@ void JSCExecutor::terminateOnJSVMThread() {
m_nativeModules.reset();
if (canUseInspector(m_context)) {
IInspector* pInspector = JSC_JSInspectorGetInstance(true);
pInspector->unregisterGlobalContext(m_context);
}
#ifdef WITH_INSPECTOR
Inspector::instance().unregisterGlobalContext(m_context);
#endif
JSC_JSGlobalContextRelease(m_context);
m_context = nullptr;