Skip to content

Commit f798e2b

Browse files
sherginfacebook-github-bot
authored andcommitted
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
1 parent 62a079e commit f798e2b

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

React/CxxBridge/RCTCxxBridge.mm

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@
4949
#import <React/RCTDevLoadingView.h>
5050
#endif
5151

52-
#define RCTAssertJSThread() \
53-
RCTAssert(self.executorClass || self->_jsThread == [NSThread currentThread], \
54-
@"This method must be called on JS thread")
55-
5652
static NSString *const RCTJSThreadName = @"com.facebook.react.JavaScript";
5753

5854
typedef void (^RCTPendingCall)();
@@ -557,7 +553,6 @@ - (void)_initializeBridge:(std::shared_ptr<JSExecutorFactory>)executorFactory
557553
return;
558554
}
559555

560-
RCTAssertJSThread();
561556
__weak RCTCxxBridge *weakSelf = self;
562557
_jsMessageThread = std::make_shared<RCTMessageThread>([NSRunLoop currentRunLoop], ^(NSError *error) {
563558
if (error) {
@@ -1289,8 +1284,6 @@ - (void)enqueueCallback:(NSNumber *)cbID args:(NSArray *)args
12891284
*/
12901285
- (void)_immediatelyCallTimer:(NSNumber *)timer
12911286
{
1292-
RCTAssertJSThread();
1293-
12941287
if (_reactInstance) {
12951288
_reactInstance->callJSFunction("JSTimers", "callTimers",
12961289
folly::dynamic::array(folly::dynamic::array([timer doubleValue])));

0 commit comments

Comments
 (0)