Permalink
Browse files

Remove deprecated method 'RCTExecuteOnMainThread'

Summary:
**Motivation**

This finishes the job of #11817, removing the previously deprecated method. See #11736 for more context.

**Test plan**

There were no tests for this method, and I searched the whole project to make sure we weren't relying on it anywhere.
Closes #11854

Differential Revision: D4421671

Pulled By: javache

fbshipit-source-id: 67e0db8d3c594ad3ccd6ccdae08f8ce49ddb8a34
  • Loading branch information...
neilsarkar authored and facebook-github-bot committed Jan 16, 2017
1 parent a531efe commit 302d42da7f5a4565a4298bb5e54b6a3386e29339
Showing with 6 additions and 30 deletions.
  1. +6 −10 React/Base/RCTModuleData.mm
  2. +0 −5 React/Base/RCTUtils.h
  3. +0 −15 React/Base/RCTUtils.m
@@ -219,12 +219,10 @@ - (BOOL)hasInstance
if (!RCTIsMainQueue()) {
RCTLogWarn(@"RCTBridge required dispatch_sync to load %@. This may lead to deadlocks", _moduleClass);
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
RCTExecuteOnMainThread(^{
RCTUnsafeExecuteOnMainQueueSync(^{
[self setUpInstanceAndBridge];
}, YES);
#pragma clang diagnostic pop
});
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
} else {
[self setUpInstanceAndBridge];
@@ -286,12 +284,10 @@ - (void)gatherConstants
if (!RCTIsMainQueue()) {
RCTLogWarn(@"Required dispatch_sync to load constants for %@. This may lead to deadlocks", _moduleClass);
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
RCTExecuteOnMainThread(^{
RCTUnsafeExecuteOnMainQueueSync(^{
self->_constantsToExport = [self->_instance constantsToExport] ?: @{};
}, YES);
#pragma clang diagnostic pop
});
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");
}
}
View
@@ -42,11 +42,6 @@ RCT_EXTERN void RCTExecuteOnMainQueue(dispatch_block_t block);
// Please do not use this unless you know what you're doing.
RCT_EXTERN void RCTUnsafeExecuteOnMainQueueSync(dispatch_block_t block);
// Deprecated - do not use.
RCT_EXTERN void RCTExecuteOnMainThread(dispatch_block_t block, BOOL sync)
__deprecated_msg("Use RCTExecuteOnMainQueue instead. RCTExecuteOnMainQueue is "
"async. If you need to use the `sync` option... please don't.");
// Get screen metrics in a thread-safe way
RCT_EXTERN CGFloat RCTScreenScale(void);
RCT_EXTERN CGSize RCTScreenSize(void);
View
@@ -265,21 +265,6 @@ void RCTUnsafeExecuteOnMainQueueSync(dispatch_block_t block)
}
}
void RCTExecuteOnMainThread(dispatch_block_t block, BOOL sync)
{
if (RCTIsMainQueue()) {
block();
} else if (sync) {
dispatch_sync(dispatch_get_main_queue(), ^{
block();
});
} else {
dispatch_async(dispatch_get_main_queue(), ^{
block();
});
}
}
CGFloat RCTScreenScale()
{
static CGFloat scale;

0 comments on commit 302d42d

Please sign in to comment.