From 302d42da7f5a4565a4298bb5e54b6a3386e29339 Mon Sep 17 00:00:00 2001 From: Neil Sarkar Date: Mon, 16 Jan 2017 15:03:19 -0800 Subject: [PATCH] Remove deprecated method 'RCTExecuteOnMainThread' Summary: **Motivation** This finishes the job of #11817, removing the previously deprecated method. See https://github.com/facebook/react-native/issues/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 https://github.com/facebook/react-native/pull/11854 Differential Revision: D4421671 Pulled By: javache fbshipit-source-id: 67e0db8d3c594ad3ccd6ccdae08f8ce49ddb8a34 --- React/Base/RCTModuleData.mm | 16 ++++++---------- React/Base/RCTUtils.h | 5 ----- React/Base/RCTUtils.m | 15 --------------- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/React/Base/RCTModuleData.mm b/React/Base/RCTModuleData.mm index 67e08f5df..69d367f2c 100644 --- a/React/Base/RCTModuleData.mm +++ b/React/Base/RCTModuleData.mm @@ -219,12 +219,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init); 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 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init); 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, @""); } } diff --git a/React/Base/RCTUtils.h b/React/Base/RCTUtils.h index fabed4a22..a277120e2 100644 --- a/React/Base/RCTUtils.h +++ b/React/Base/RCTUtils.h @@ -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); diff --git a/React/Base/RCTUtils.m b/React/Base/RCTUtils.m index 6596d6949..9617d0a3a 100644 --- a/React/Base/RCTUtils.m +++ b/React/Base/RCTUtils.m @@ -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;