From f798e2bc8dd0f476cca21beadb4a399cf1de791f Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Thu, 12 Dec 2019 12:46:33 -0800 Subject: [PATCH] RCTAssertJSThread was removed Summary: RCTAssertJSThread is a specific to RCTCxxBridge assert that ensured that the code is executed on JavaScript thread. It was here from the very beginning. Now we need to remove it. Reasons: - The overall concept of limiting the execution of JavaScript code to a single thread is gone. Now we think about this as some queue, not thread. Fabric heavily relies on that and that asserts fires in Fabric. - The assert is already far from being trivial: it checks for a custom executor, and if it's not nil, it does not fire. We can introduce another special flag for Fabric that will also disable that... but that's pointless. Such kinda asserts should not be complex to be useful. - This asserts was used only in two places, and both of them are not exposed as public API. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D18946388 fbshipit-source-id: 1e5fc732abdcb4bff3cfadcba24f7a433f1a480e --- React/CxxBridge/RCTCxxBridge.mm | 7 ------- 1 file changed, 7 deletions(-) diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 18b0e09b042..29d86e144d0 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -49,10 +49,6 @@ #import #endif -#define RCTAssertJSThread() \ - RCTAssert(self.executorClass || self->_jsThread == [NSThread currentThread], \ - @"This method must be called on JS thread") - static NSString *const RCTJSThreadName = @"com.facebook.react.JavaScript"; typedef void (^RCTPendingCall)(); @@ -557,7 +553,6 @@ struct RCTInstanceCallback : public InstanceCallback { return; } - RCTAssertJSThread(); __weak RCTCxxBridge *weakSelf = self; _jsMessageThread = std::make_shared([NSRunLoop currentRunLoop], ^(NSError *error) { if (error) { @@ -1289,8 +1284,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR */ - (void)_immediatelyCallTimer:(NSNumber *)timer { - RCTAssertJSThread(); - if (_reactInstance) { _reactInstance->callJSFunction("JSTimers", "callTimers", folly::dynamic::array(folly::dynamic::array([timer doubleValue])));