Allow extending UIViewOperationQueue

Summary: public I need to extend NativeViewHierarchyManager to support a richer set of operations on Views, and those operations needs to be ran in UI thread.
Existing UIViewOperationQueue doesn't know about those operations, so I need to extend it too to allow them. This patch is making the class constructor protected to allow subclassing it from another package. Should not have any functional changes.

Reviewed By: astreet

Differential Revision: D2554826

fb-gh-sync-id: ad2d44a61beb216d940e20cd1489d3b5da1b398b
This commit is contained in:
Denis Koroskin 2015-11-30 16:36:54 -08:00 committed by facebook-github-bot-6
parent 8f2023d961
commit c4c74215fa
1 changed files with 10 additions and 2 deletions

View File

@ -46,7 +46,7 @@ public class UIViewOperationQueue {
/**
* A mutation or animation operation on the view hierarchy.
*/
private interface UIOperation {
protected interface UIOperation {
void execute();
}
@ -440,7 +440,7 @@ public class UIViewOperationQueue {
private @Nullable NotThreadSafeViewHierarchyUpdateDebugListener mViewHierarchyUpdateDebugListener;
/* package */ UIViewOperationQueue(
protected UIViewOperationQueue(
ReactApplicationContext reactContext,
NativeViewHierarchyManager nativeViewHierarchyManager) {
mNativeViewHierarchyManager = nativeViewHierarchyManager;
@ -484,6 +484,14 @@ public class UIViewOperationQueue {
}
}
/**
* Enqueues a UIOperation to be executed in UI thread. This method should only be used by a
* subclass to support UIOperations not provided by UIViewOperationQueue.
*/
protected void enqueueUIOperation(UIOperation operation) {
mOperations.add(operation);
}
public void enqueueRemoveRootView(int rootViewTag) {
mOperations.add(new RemoveRootViewOperation(rootViewTag));
}