Create CXX Binding

Summary: This diff creates the C++ base classes for Fabric and it integrates them into the starting process of Fabric inside Catalyst App

Reviewed By: shergin

Differential Revision: D8786185

fbshipit-source-id: d04208f0781387424fc0ddf7a6e5d46a6bd61f66
This commit is contained in:
David Vacca 2018-07-17 01:35:10 -07:00 committed by Facebook Github Bot
parent 46164324cd
commit e155e78451
4 changed files with 21 additions and 3 deletions

View File

@ -0,0 +1,14 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.fabric;
public interface FabricBinder {
void setBinding(FabricBinding binding);
}

View File

@ -9,10 +9,11 @@ package com.facebook.react.fabric;
import com.facebook.react.bridge.JavaScriptContextHolder;
import com.facebook.react.bridge.NativeMap;
import com.facebook.react.bridge.UIManager;
public interface FabricBinding {
void installFabric(JavaScriptContextHolder jsContext, FabricUIManager fabricModule);
void installFabric(JavaScriptContextHolder jsContext, FabricBinder fabricBinder);
void releaseEventTarget(long jsContextNativePointer, long eventTargetPointer);

View File

@ -60,7 +60,7 @@ import javax.annotation.Nullable;
*/
@SuppressWarnings("unused") // used from JNI
@DoNotStrip
public class FabricUIManager implements UIManager, JSHandler {
public class FabricUIManager implements UIManager, JSHandler, FabricBinder {
private static final String TAG = FabricUIManager.class.getSimpleName();
private static final boolean DEBUG = ReactBuildConfig.DEBUG || PrinterHolder.getPrinter().shouldDisplayLogMessage(ReactDebugOverlayTags.FABRIC_UI_MANAGER);
@ -98,6 +98,7 @@ public class FabricUIManager implements UIManager, JSHandler {
mJSContext = jsContext;
}
@Override
public void setBinding(FabricBinding binding) {
mBinding = binding;
}

View File

@ -10,6 +10,8 @@ package com.facebook.react.fabric.jsc;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.JavaScriptContextHolder;
import com.facebook.react.bridge.UIManager;
import com.facebook.react.fabric.FabricBinder;
import com.facebook.react.fabric.FabricBinding;
import com.facebook.react.fabric.FabricUIManager;
import com.facebook.react.bridge.NativeMap;
@ -58,7 +60,7 @@ public class FabricJSCBinding implements FabricBinding {
}
@Override
public void installFabric(JavaScriptContextHolder jsContext, FabricUIManager fabricModule) {
public void installFabric(JavaScriptContextHolder jsContext, FabricBinder fabricModule) {
fabricModule.setBinding(this);
installFabric(jsContext.get(), fabricModule);
}