mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-07 23:27:05 +08:00
Reverted commit D3580025
Reviewed By: mhorowitz Differential Revision: D3580025 fbshipit-source-id: 4422b6b97ef844158e369e022d62d6f0ae641222
This commit is contained in:
committed by
Facebook Github Bot 3
parent
ed89d5ba0d
commit
b83ccb5749
@@ -83,14 +83,14 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
||||
|
||||
- (void)setUpInstanceAndBridge
|
||||
{
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData setUpInstanceAndBridge] [_instanceLock lock]", @{ @"moduleClass": _moduleClass });
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData setUpInstanceAndBridge] [_instanceLock lock]", nil);
|
||||
[_instanceLock lock];
|
||||
if (!_setupComplete && _bridge.valid) {
|
||||
if (!_instance) {
|
||||
if (RCT_DEBUG && _requiresMainQueueSetup) {
|
||||
RCTAssertMainQueue();
|
||||
}
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData setUpInstanceAndBridge] [_moduleClass new]", @{ @"moduleClass": _moduleClass });
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData setUpInstanceAndBridge] [_moduleClass new]", nil);
|
||||
_instance = [_moduleClass new];
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
if (!_instance) {
|
||||
@@ -216,10 +216,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
||||
// get accessed by client code during bridge setup, and a very low risk of
|
||||
// deadlock is better than a fairly high risk of an assertion being thrown.
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData instance] main thread setup", nil);
|
||||
|
||||
if (!RCTIsMainQueue()) {
|
||||
RCTLogError(@"RCTBridge required dispatch_sync to load %@. This may lead to deadlocks", _moduleClass);
|
||||
}
|
||||
RCTExecuteOnMainThread(^{
|
||||
[self setUpInstanceAndBridge];
|
||||
}, YES);
|
||||
@@ -282,9 +278,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
||||
if (_hasConstantsToExport && !_constantsToExport) {
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, [NSString stringWithFormat:@"[RCTModuleData gatherConstants] %@", _moduleClass], nil);
|
||||
(void)[self instance];
|
||||
if (!RCTIsMainQueue()) {
|
||||
RCTLogError(@"Required dispatch_sync to load constants for %@. This may lead to deadlocks", _moduleClass);
|
||||
}
|
||||
RCTExecuteOnMainThread(^{
|
||||
self->_constantsToExport = [self->_instance constantsToExport] ?: @{};
|
||||
}, YES);
|
||||
|
||||
Reference in New Issue
Block a user