From fd29878a8b64f645c3b6d92eab361f0b7b4d07d1 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Wed, 15 Aug 2018 17:49:15 -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: D8878123 fbshipit-source-id: ce41ad6addfdfb58e602b2dbafebd8f05847e69f --- .../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); }