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
This commit is contained in:
Denis Koroskin 2015-11-25 21:16:58 -08:00 committed by facebook-github-bot-5
parent 0e11379dbb
commit 16350ae09b
3 changed files with 10 additions and 14 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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);
}