Reverted commit D3400379

Reviewed By: mhorowitz

Differential Revision: D3400379

fbshipit-source-id: b7e733e74bb0f4fbd597fd073826c399ece2c47f
This commit is contained in:
Konstantin Raev 2016-06-08 02:47:45 -07:00 committed by Facebook Github Bot 2
parent b0fed416cb
commit 525d35ba67
36 changed files with 72 additions and 72 deletions

View File

@ -14,10 +14,6 @@ import com.facebook.soloader.SoLoader;
@DoNotStrip
public class JSCJavaScriptExecutor extends JavaScriptExecutor {
static {
ReactBridge.staticInit();
}
public static class Factory implements JavaScriptExecutor.Factory {
@Override
public JavaScriptExecutor create(WritableNativeMap jscConfig) throws Exception {
@ -25,6 +21,10 @@ public class JSCJavaScriptExecutor extends JavaScriptExecutor {
}
}
static {
SoLoader.loadLibrary(ReactBridge.REACT_NATIVE_LIB);
}
public JSCJavaScriptExecutor(WritableNativeMap jscConfig) {
initialize(jscConfig);
}

View File

@ -19,7 +19,7 @@ import com.facebook.soloader.SoLoader;
@DoNotStrip
public abstract class NativeArray {
static {
ReactBridge.staticInit();
SoLoader.loadLibrary(ReactBridge.REACT_NATIVE_LIB);
}
protected NativeArray(HybridData hybridData) {

View File

@ -19,7 +19,7 @@ import com.facebook.soloader.SoLoader;
@DoNotStrip
public abstract class NativeMap {
static {
ReactBridge.staticInit();
SoLoader.loadLibrary(ReactBridge.REACT_NATIVE_LIB);
}
public NativeMap(HybridData hybridData) {

View File

@ -24,10 +24,6 @@ import com.facebook.proguard.annotations.DoNotStrip;
*/
@DoNotStrip
public class ProxyJavaScriptExecutor extends JavaScriptExecutor {
static {
ReactBridge.staticInit();
}
public static class Factory implements JavaScriptExecutor.Factory {
private final JavaJSExecutor.Factory mJavaJSExecutorFactory;
@ -41,6 +37,10 @@ public class ProxyJavaScriptExecutor extends JavaScriptExecutor {
}
}
static {
SoLoader.loadLibrary(ReactBridge.REACT_NATIVE_LIB);
}
private @Nullable JavaJSExecutor mJavaJSExecutor;
/**

View File

@ -24,22 +24,16 @@ import com.facebook.soloader.SoLoader;
@DoNotStrip
public class ReactBridge extends Countable {
private static final String REACT_NATIVE_LIB = "reactnativejni";
private static final String XREACT_NATIVE_LIB = "reactnativejnifb";
/* package */ static final String REACT_NATIVE_LIB = "reactnativejni";
static {
staticInit();
SoLoader.loadLibrary(REACT_NATIVE_LIB);
}
private final ReactCallback mCallback;
private final JavaScriptExecutor mJSExecutor;
private final MessageQueueThread mNativeModulesQueueThread;
public static void staticInit() {
SoLoader.loadLibrary(REACT_NATIVE_LIB);
SoLoader.loadLibrary(XREACT_NATIVE_LIB);
}
/**
* @param jsExecutor the JS executor to use to run JS
* @param callback the callback class used to invoke native modules

View File

@ -21,8 +21,9 @@ import java.util.ArrayList;
*/
@DoNotStrip
public class ReadableNativeArray extends NativeArray implements ReadableArray {
static {
ReactBridge.staticInit();
SoLoader.loadLibrary(ReactBridge.REACT_NATIVE_LIB);
}
protected ReadableNativeArray(HybridData hybridData) {

View File

@ -22,8 +22,9 @@ import java.util.HashMap;
*/
@DoNotStrip
public class ReadableNativeMap extends NativeMap implements ReadableMap {
static {
ReactBridge.staticInit();
SoLoader.loadLibrary(ReactBridge.REACT_NATIVE_LIB);
}
protected ReadableNativeMap(HybridData hybridData) {

View File

@ -21,8 +21,9 @@ import com.facebook.soloader.SoLoader;
*/
@DoNotStrip
public class WritableNativeArray extends ReadableNativeArray implements WritableArray {
static {
ReactBridge.staticInit();
SoLoader.loadLibrary(ReactBridge.REACT_NATIVE_LIB);
}
public WritableNativeArray() {

View File

@ -22,7 +22,7 @@ import com.facebook.soloader.SoLoader;
@DoNotStrip
public class WritableNativeMap extends ReadableNativeMap implements WritableMap {
static {
ReactBridge.staticInit();
SoLoader.loadLibrary(ReactBridge.REACT_NATIVE_LIB);
}
@Override

View File

@ -11,8 +11,15 @@ LOCAL_SRC_FILES := \
JSLoader.cpp \
JSLogging.cpp \
JniJSModulesUnbundle.cpp \
NativeArray.cpp \
NativeCommon.cpp \
NativeMap.cpp \
OnLoad.cpp \
ProxyExecutor.cpp \
ReadableNativeArray.cpp \
ReadableNativeMap.cpp \
WritableNativeArray.cpp \
WritableNativeMap.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../.. $(LOCAL_PATH)/..
@ -23,7 +30,7 @@ LOCAL_CFLAGS += $(CXX11_FLAGS)
LOCAL_EXPORT_CPPFLAGS := $(CXX11_FLAGS)
LOCAL_LDLIBS += -landroid
LOCAL_SHARED_LIBRARIES := libfolly_json libfb libjsc libglog_init libreactnativejnifb
LOCAL_SHARED_LIBRARIES := libfolly_json libfb libjsc libglog_init
LOCAL_STATIC_LIBRARIES := libreactnative
include $(BUILD_SHARED_LIBRARY)
@ -34,4 +41,3 @@ $(call import-module,folly)
$(call import-module,fbgloginit)
$(call import-module,fb)
$(call import-module,jsc)
$(call import-module,xreact/jni)

View File

@ -18,7 +18,6 @@ def jni_library(**kwargs):
],
deps = DEPS + JSC_DEPS + [
react_native_target('jni/react:react'),
react_native_target('jni/xreact/jni:jni'),
],
**kwargs
)
@ -34,8 +33,15 @@ jni_library(
'JSLoader.cpp',
'JSLogging.cpp',
'JniJSModulesUnbundle.cpp',
'NativeArray.cpp',
'NativeCommon.cpp',
'NativeMap.cpp',
'OnLoad.cpp',
'ProxyExecutor.cpp',
'ReadableNativeArray.cpp',
'ReadableNativeMap.cpp',
'WritableNativeArray.cpp',
'WritableNativeMap.cpp',
],
headers = [
'JSLoader.h',
@ -50,6 +56,13 @@ jni_library(
'WebWorkers.h',
],
exported_headers = [
'NativeCommon.h',
'NativeArray.h',
'NativeMap.h',
'ReadableNativeArray.h',
'ReadableNativeMap.h',
'WritableNativeArray.h',
'WritableNativeMap.h',
],
preprocessor_flags = [
'-DLOG_TAG="ReactNativeJNI"',

View File

@ -22,6 +22,8 @@
#include "JExecutorTokenFactory.h"
#include "JNativeRunnable.h"
#include "JSLoader.h"
#include "NativeCommon.h"
#include "ReadableNativeArray.h"
#include "ProxyExecutor.h"
#include "OnLoad.h"
#include "JMessageQueueThread.h"
@ -29,9 +31,7 @@
#include "JSLogging.h"
#include "JSCPerfLogging.h"
#include "WebWorkers.h"
#include <xreact/jni/ReadableNativeArray.h>
#include <xreact/jni/WritableNativeMap.h>
#include "WritableNativeMap.h"
#include <algorithm>
#ifdef WITH_FBSYSTRACE
@ -456,9 +456,17 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
PerfLogging::installNativeHooks = addNativePerfLoggingHooks;
JSLogging::nativeHook = nativeLoggingHook;
NativeArray::registerNatives();
ReadableNativeArray::registerNatives();
WritableNativeArray::registerNatives();
JNativeRunnable::registerNatives();
registerJSLoaderNatives();
NativeMap::registerNatives();
ReadableNativeMap::registerNatives();
WritableNativeMap::registerNatives();
ReadableNativeMapKeySetIterator::registerNatives();
registerNatives("com/facebook/react/bridge/JSCJavaScriptExecutor", {
makeNativeMethod("initialize", executors::createJSCExecutor),
});

View File

@ -20,7 +20,6 @@ struct WritableNativeMap : jni::HybridClass<WritableNativeMap, ReadableNativeMap
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jclass>);
__attribute__((visibility("default")))
folly::dynamic consume();
void putNull(std::string key);

View File

@ -9,21 +9,14 @@ LOCAL_SRC_FILES := \
CxxModuleWrapper.cpp \
JExecutorToken.cpp \
JMessageQueueThread.cpp \
JniJSModulesUnbundle.cpp \
JSCPerfLogging.cpp \
JSLoader.cpp \
JSLogging.cpp \
JniJSModulesUnbundle.cpp \
MethodInvoker.cpp \
ModuleRegistryHolder.cpp \
NativeArray.cpp \
NativeCommon.cpp \
NativeMap.cpp \
OnLoad.cpp \
ProxyExecutor.cpp \
ReadableNativeArray.cpp \
ReadableNativeMap.cpp \
WritableNativeArray.cpp \
WritableNativeMap.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../..
@ -34,7 +27,7 @@ LOCAL_CFLAGS += $(CXX11_FLAGS)
LOCAL_EXPORT_CPPFLAGS := $(CXX11_FLAGS)
LOCAL_LDLIBS += -landroid
LOCAL_SHARED_LIBRARIES := libfolly_json libfbjni libjsc libglog_init
LOCAL_SHARED_LIBRARIES := libfolly_json libfbjni libjsc libglog_init libreactnativejni
LOCAL_STATIC_LIBRARIES := libreactnativefb
include $(BUILD_SHARED_LIBRARY)
@ -44,3 +37,4 @@ $(call import-module,jsc)
$(call import-module,folly)
$(call import-module,fbgloginit)
$(call import-module,jsc)
$(call import-module,react/jni)

View File

@ -5,25 +5,19 @@ SUPPORTED_PLATFORMS = '^android-(armv7|x86)$'
EXPORTED_HEADERS = [
'CxxModuleWrapper.h',
'NativeArray.h',
'NativeCommon.h',
'NativeMap.h',
'ReadableNativeArray.h',
'ReadableNativeMap.h',
'WritableNativeArray.h',
'WritableNativeMap.h',
]
cxx_library(
name='jni',
soname = 'libreactnativejnifb.so',
header_namespace = 'xreact/jni',
header_namespace = 'react/jni',
supported_platforms_regex = SUPPORTED_PLATFORMS,
deps = JSC_DEPS + [
'//native/fb:fb',
'//native/third-party/android-ndk:android',
'//xplat/folly:molly',
'//xplat/fbsystrace:fbsystrace',
react_native_target('jni/react/jni:jni'),
react_native_xplat_target('cxxreact:bridge'),
react_native_xplat_target('cxxreact:module'),
],

View File

@ -13,6 +13,8 @@
#include <jni/Countable.h>
#include <jni/LocalReference.h>
#include <react/jni/NativeArray.h>
#include <cxxreact/Instance.h>
#include <cxxreact/MethodCall.h>
#include <cxxreact/ModuleRegistry.h>
@ -21,7 +23,6 @@
#include "JavaScriptExecutorHolder.h"
#include "JniJSModulesUnbundle.h"
#include "ModuleRegistryHolder.h"
#include "NativeArray.h"
#include "JNativeRunnable.h"
using namespace facebook::jni;

View File

@ -2,11 +2,16 @@
#include "CxxModuleWrapper.h"
#include <react/jni/ReadableNativeArray.h>
#include <fb/fbjni.h>
#include <fb/Environment.h>
#include <jni/LocalString.h>
#include <jni/Registration.h>
#include <cxxreact/JsArgumentHelpers.h>
#include <cxxreact/FollySupport.h>
#include <android/log.h>
#include <folly/json.h>
@ -15,12 +20,6 @@
#include <unordered_set>
#include <dlfcn.h>
#include <cxxreact/JsArgumentHelpers.h>
#include <cxxreact/FollySupport.h>
#include "ReadableNativeArray.h"
using namespace facebook::jni;
using namespace facebook::xplat::module;
using namespace facebook::react;

View File

@ -7,7 +7,7 @@
#include <folly/dynamic.h>
#include <fb/fbjni.h>
#include "NativeArray.h"
#include <react/jni/NativeArray.h>
namespace facebook {
namespace react {

View File

@ -2,10 +2,9 @@
#include "JSCPerfLogging.h"
#include <cxxreact/JSCHelpers.h>
#include <fb/log.h>
#include <fb/fbjni.h>
#include <react/JSCHelpers.h>
using namespace facebook::jni;

View File

@ -4,10 +4,9 @@
#include <android/log.h>
#include <algorithm>
#include <react/Value.h>
#include <fb/log.h>
#include <cxxreact/Value.h>
namespace facebook {
namespace react {

View File

@ -2,6 +2,7 @@
#include "MethodInvoker.h"
#include <react/jni/ReadableNativeArray.h>
#ifdef WITH_FBSYSTRACE
#include <fbsystrace.h>
#endif
@ -9,7 +10,6 @@
#include "ModuleRegistryHolder.h"
#include "JCallback.h"
#include "JExecutorToken.h"
#include "ReadableNativeArray.h"
namespace facebook {
namespace react {

View File

@ -10,10 +10,11 @@
#include <cxxreact/Instance.h>
#include <cxxreact/JsArgumentHelpers.h>
#include <cxxreact/NativeModule.h>
#include <react/jni/ReadableNativeArray.h>
#include "MethodInvoker.h"
#include "CatalystInstanceImpl.h"
#include "MethodInvoker.h"
#include "ReadableNativeArray.h"
using facebook::xplat::module::CxxModule;

View File

@ -7,6 +7,7 @@
#include <cxxreact/JSCExecutor.h>
#include <cxxreact/Platform.h>
#include <cxxreact/Value.h>
#include <react/jni/ReadableNativeArray.h>
#include "CatalystInstanceImpl.h"
#include "JavaScriptExecutorHolder.h"
#include "JSCPerfLogging.h"
@ -16,9 +17,6 @@
#include "WebWorkers.h"
#include "JCallback.h"
#include "WritableNativeMap.h"
#include "WritableNativeArray.h"
#include <string>
using namespace facebook::jni;
@ -182,14 +180,6 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
CxxModuleWrapper::registerNatives();
JCallbackImpl::registerNatives();
registerJSLoaderNatives();
NativeArray::registerNatives();
ReadableNativeArray::registerNatives();
WritableNativeArray::registerNatives();
NativeMap::registerNatives();
ReadableNativeMap::registerNatives();
WritableNativeMap::registerNatives();
ReadableNativeMapKeySetIterator::registerNatives();
});
}