From 16350ae09b4fb5bbeb3edc8cc9df623e4048c6b1 Mon Sep 17 00:00:00 2001 From: Denis Koroskin Date: Wed, 25 Nov 2015 21:16:58 -0800 Subject: [PATCH] Remove AnimationRegistry from UIManageModule Summary: public UIManageModule creates AnimationRegistry but never uses it, this diff moves it to NativeViewHierarchyManager who owns it. UIViewOperationQueue depends on AnimationRegistry to perform some of the enqueued operations, so it accessed it through a getting in NativeViewHierarchyManager. This will also make sure NativeViewHierarchyManager. and UIViewOperationQueue operate on the same AnimationManager (previously, that wasn't really enforced). This is needed so I can move away UIViewOperationQueue creation off the UIManagerModule. This diff should have no functional changes whatsoever. Reviewed By: astreet Differential Revision: D2462605 fb-gh-sync-id: 1e3cd64908f51126362f2b5fb39b1efa6521854e --- .../react/uimanager/NativeViewHierarchyManager.java | 10 ++++++---- .../com/facebook/react/uimanager/UIManagerModule.java | 9 ++------- .../facebook/react/uimanager/UIViewOperationQueue.java | 5 ++--- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java index 0b7b7e1f0..cf3c56455 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java @@ -67,10 +67,8 @@ import com.facebook.react.touch.JSResponderHandler; private final JSResponderHandler mJSResponderHandler = new JSResponderHandler(); private final RootViewManager mRootViewManager = new RootViewManager(); - public NativeViewHierarchyManager( - AnimationRegistry animationRegistry, - ViewManagerRegistry viewManagers) { - mAnimationRegistry = animationRegistry; + public NativeViewHierarchyManager(ViewManagerRegistry viewManagers) { + mAnimationRegistry = new AnimationRegistry(); mViewManagers = viewManagers; mTagsToViews = new SparseArray<>(); mTagsToViewManagers = new SparseArray<>(); @@ -78,6 +76,10 @@ import com.facebook.react.touch.JSResponderHandler; mRootViewsContext = new SparseArray<>(); } + public AnimationRegistry getAnimationRegistry() { + return mAnimationRegistry; + } + public void updateProperties(int tag, CatalystStylesDiffMap props) { UiThreadUtil.assertOnUiThread(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java index 1512f305f..f8609dc61 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java @@ -22,7 +22,6 @@ import android.util.DisplayMetrics; import com.facebook.csslayout.CSSLayoutContext; import com.facebook.infer.annotation.Assertions; import com.facebook.react.animation.Animation; -import com.facebook.react.animation.AnimationRegistry; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.Callback; import com.facebook.react.bridge.LifecycleEventListener; @@ -78,7 +77,6 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements private final NativeViewHierarchyManager mNativeViewHierarchyManager; private final EventDispatcher mEventDispatcher; - private final AnimationRegistry mAnimationRegistry = new AnimationRegistry(); private final ShadowNodeRegistry mShadowNodeRegistry = new ShadowNodeRegistry(); private final ViewManagerRegistry mViewManagers; private final CSSLayoutContext mLayoutContext = new CSSLayoutContext(); @@ -94,13 +92,10 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements super(reactContext); mViewManagers = new ViewManagerRegistry(viewManagerList); mEventDispatcher = new EventDispatcher(reactContext); - mNativeViewHierarchyManager = new NativeViewHierarchyManager( - mAnimationRegistry, - mViewManagers); + mNativeViewHierarchyManager = new NativeViewHierarchyManager(mViewManagers); mOperationsQueue = new UIViewOperationQueue( reactContext, - mNativeViewHierarchyManager, - mAnimationRegistry); + mNativeViewHierarchyManager); mNativeViewHierarchyOptimizer = new NativeViewHierarchyOptimizer( mOperationsQueue, mShadowNodeRegistry); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java index a931b5e0f..d118561be 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java @@ -456,10 +456,9 @@ public class UIViewOperationQueue { /* package */ UIViewOperationQueue( ReactApplicationContext reactContext, - NativeViewHierarchyManager nativeViewHierarchyManager, - AnimationRegistry animationRegistry) { + NativeViewHierarchyManager nativeViewHierarchyManager) { mNativeViewHierarchyManager = nativeViewHierarchyManager; - mAnimationRegistry = animationRegistry; + mAnimationRegistry = nativeViewHierarchyManager.getAnimationRegistry(); mDispatchUIFrameCallback = new DispatchUIFrameCallback(reactContext); }