mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-06 22:37:14 +08:00
[ReactNative] Add RCTAssertThread and restrict -[UIManager addUIBlock:] to _shadowQueue
Summary: @public Add `RCTAssertThread` to `RCTAssert.h` for convenience when checking the current/queue, it accepts either a `NSString *`, `NSThread *` or `dispatch_queue_t` as the object to be checked Also add a check to `-[RCTUIManager addUIBlock:]` - There was a discussion on github (https://github.com/facebook/react-native/issues/1365) due to the weird behavior caused by calling it from a different thread/queue (it might be added after `batchDidComplete` has been called and will just be dispatched on the next call from JS to objc) Test Plan: Change `-[RCTAnimationExperimentalManager methodQueue]` to return `dispatch_get_main_queue()` and run the 2048 example, it should dispatch with a helpful message (screenshot on the comments)
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "RCTAssert.h"
|
||||
#import "RCTDefines.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTUtils.h"
|
||||
|
||||
#if RCT_DEV
|
||||
@@ -43,7 +43,7 @@ NSLock *_RCTProfileLock;
|
||||
#define RCTProfileAddEvent(type, props...) \
|
||||
[RCTProfileInfo[type] addObject:@{ \
|
||||
@"pid": @([[NSProcessInfo processInfo] processIdentifier]), \
|
||||
@"tid": RCTThreadName([NSThread currentThread]), \
|
||||
@"tid": RCTCurrentThreadName(), \
|
||||
props \
|
||||
}];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user