mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-22 11:16:06 +08:00
Make JavaScriptExecutor.Factory a configurable property of ReactInstanceManager
Reviewed By: mhorowitz Differential Revision: D5662431 fbshipit-source-id: 17dca2744de645740cef252efbf83902acde5046
This commit is contained in:
committed by
Facebook Github Bot
parent
606a876df7
commit
73f17908e6
@@ -13,27 +13,12 @@ import com.facebook.jni.HybridData;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public class JSCJavaScriptExecutor extends JavaScriptExecutor {
|
||||
public static class Factory implements JavaScriptExecutor.Factory {
|
||||
private ReadableNativeMap mJSCConfig;
|
||||
|
||||
public Factory() {
|
||||
WritableNativeMap jscConfig = new WritableNativeMap();
|
||||
jscConfig.putString("OwnerIdentity", "ReactNative");
|
||||
mJSCConfig = jscConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaScriptExecutor create() throws Exception {
|
||||
return new JSCJavaScriptExecutor(mJSCConfig);
|
||||
}
|
||||
}
|
||||
|
||||
/* package */ class JSCJavaScriptExecutor extends JavaScriptExecutor {
|
||||
static {
|
||||
ReactBridge.staticInit();
|
||||
}
|
||||
|
||||
private JSCJavaScriptExecutor(ReadableNativeMap jscConfig) {
|
||||
/* package */ JSCJavaScriptExecutor(ReadableNativeMap jscConfig) {
|
||||
super(initHybrid(jscConfig));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
public class JSCJavaScriptExecutorFactory implements JavaScriptExecutorFactory {
|
||||
@Override
|
||||
public JavaScriptExecutor create() throws Exception {
|
||||
WritableNativeMap jscConfig = new WritableNativeMap();
|
||||
jscConfig.putString("OwnerIdentity", "ReactNative");
|
||||
return new JSCJavaScriptExecutor(jscConfig);
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,6 @@ import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public abstract class JavaScriptExecutor {
|
||||
public interface Factory {
|
||||
JavaScriptExecutor create() throws Exception;
|
||||
}
|
||||
|
||||
private final HybridData mHybridData;
|
||||
|
||||
protected JavaScriptExecutor(HybridData hybridData) {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
public interface JavaScriptExecutorFactory {
|
||||
JavaScriptExecutor create() throws Exception;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import com.facebook.proguard.annotations.DoNotStrip;
|
||||
*/
|
||||
@DoNotStrip
|
||||
public class ProxyJavaScriptExecutor extends JavaScriptExecutor {
|
||||
public static class Factory implements JavaScriptExecutor.Factory {
|
||||
public static class Factory implements JavaScriptExecutorFactory {
|
||||
private final JavaJSExecutor.Factory mJavaJSExecutorFactory;
|
||||
|
||||
public Factory(JavaJSExecutor.Factory javaJSExecutorFactory) {
|
||||
|
||||
Reference in New Issue
Block a user