From e155e78451ec4e736169dbd6889919d9283d3806 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 17 Jul 2018 01:35:10 -0700 Subject: [PATCH] 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 --- .../com/facebook/react/fabric/FabricBinder.java | 14 ++++++++++++++ .../com/facebook/react/fabric/FabricBinding.java | 3 ++- .../com/facebook/react/fabric/FabricUIManager.java | 3 ++- .../react/fabric/jsc/FabricJSCBinding.java | 4 +++- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinder.java diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinder.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinder.java new file mode 100644 index 000000000..e72eceb2b --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinder.java @@ -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); + +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinding.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinding.java index 4db39a425..f5e251532 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinding.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinding.java @@ -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); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index 87d1850e6..345e214c0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -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; } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jsc/FabricJSCBinding.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsc/FabricJSCBinding.java index 92e82d41e..fb1748204 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jsc/FabricJSCBinding.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsc/FabricJSCBinding.java @@ -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); }