Permalink
Browse files

Unified usage of RCTAssertUIManagerQueue

Reviewed By: javache

Differential Revision: D5440518

fbshipit-source-id: fe0df85aa3361402f9bdaa800fc3b1f10162814b
  • Loading branch information...
shergin authored and facebook-github-bot committed Jul 18, 2017
1 parent f082e6c commit 8760b938a2dea3ba3e7493d41d00007690e84907
Showing with 5 additions and 10 deletions.
  1. +5 −10 React/Modules/RCTUIManager.m
@@ -245,7 +245,7 @@ - (void)registerRootView:(RCTRootContentView *)rootView
- (NSString *)viewNameForReactTag:(NSNumber *)reactTag
{
RCTAssertThread(RCTGetUIManagerQueue(), @"viewNameForReactTag can only be called from the shadow queue");
RCTAssertUIManagerQueue();
return _shadowViewRegistry[reactTag].viewName;
}
@@ -381,9 +381,7 @@ - (void)_purgeChildren:(NSArray<id<RCTComponent>> *)children
- (void)addUIBlock:(RCTViewManagerUIBlock)block
{
RCTAssertThread(RCTGetUIManagerQueue(),
@"-[RCTUIManager addUIBlock:] should only be called from the "
"UIManager's queue (get this using `RCTGetUIManagerQueue()`)");
RCTAssertUIManagerQueue();
if (!block || !_viewRegistry) {
return;
@@ -394,9 +392,7 @@ - (void)addUIBlock:(RCTViewManagerUIBlock)block
- (void)prependUIBlock:(RCTViewManagerUIBlock)block
{
RCTAssertThread(RCTGetUIManagerQueue(),
@"-[RCTUIManager prependUIBlock:] should only be called from the "
"UIManager's queue (get this using `RCTGetUIManagerQueue()`)");
RCTAssertUIManagerQueue();
if (!block || !_viewRegistry) {
return;
@@ -420,7 +416,7 @@ - (void)setNextLayoutAnimationGroup:(RCTLayoutAnimationGroup *)layoutAnimationGr
- (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView *)rootShadowView
{
RCTAssert(!RCTIsMainQueue(), @"Should be called on shadow queue");
RCTAssertUIManagerQueue();
// This is nuanced. In the JS thread, we create a new update buffer
// `frameTags`/`frames` that is created/mutated in the JS thread. We access
@@ -1065,8 +1061,7 @@ - (void)_layoutAndMount
- (void)flushUIBlocks
{
RCTAssertThread(RCTGetUIManagerQueue(),
@"flushUIBlocks can only be called from the shadow queue");
RCTAssertUIManagerQueue();
// First copy the previous blocks into a temporary variable, then reset the
// pending blocks to a new array. This guards against mutation while

0 comments on commit 8760b93

Please sign in to comment.