@@ -1339,29 +1339,22 @@ - (void)_invokeAndProcessModule:(NSString *)module method:(NSString *)method arg
13391339 * AnyThread
13401340 */
13411341
1342- RCTProfileBeginFlowEvent ();
1343-
13441342 __weak RCTBatchedBridge *weakSelf = self;
13451343 [_javaScriptExecutor executeBlockOnJavaScriptQueue: ^{
1346- RCTProfileEndFlowEvent ();
13471344 RCTProfileBeginEvent ();
13481345
13491346 RCTBatchedBridge *strongSelf = weakSelf;
13501347 if (!strongSelf.isValid || !strongSelf->_scheduledCallbacks || !strongSelf->_scheduledCalls ) {
13511348 return ;
13521349 }
13531350
1354-
1355- RCT_IF_DEV (NSNumber *callID = _RCTProfileBeginFlowEvent ();)
13561351 id call = @{
1357- @" js_args" : @{
1358- @" module" : module,
1359- @" method" : method,
1360- @" args" : args,
1361- },
1352+ @" module" : module,
1353+ @" method" : method,
1354+ @" args" : args,
13621355 @" context" : context ?: @0 ,
1363- RCT_IF_DEV (@" call_id" : callID,)
13641356 };
1357+
13651358 if ([method isEqualToString: @" invokeCallbackAndReturnFlushedQueue" ]) {
13661359 strongSelf->_scheduledCallbacks [args[0 ]] = call;
13671360 } else {
@@ -1497,10 +1490,8 @@ - (BOOL)_handleRequestNumber:(NSUInteger)i
14971490 return NO ;
14981491 }
14991492
1500- RCTProfileBeginFlowEvent ();
15011493 __weak RCTBatchedBridge *weakSelf = self;
15021494 [self dispatchBlock: ^{
1503- RCTProfileEndFlowEvent ();
15041495 RCTProfileBeginEvent ();
15051496 RCTBatchedBridge *strongSelf = weakSelf;
15061497
@@ -1535,41 +1526,30 @@ - (void)_jsThreadUpdate:(CADisplayLink *)displayLink
15351526{
15361527 RCTAssertJSThread ();
15371528
1538- NSArray *calls = [_scheduledCallbacks.allObjects arrayByAddingObjectsFromArray: _scheduledCalls];
1539- NSNumber *currentExecutorID = RCTGetExecutorID (_javaScriptExecutor);
1540- calls = [calls filteredArrayUsingPredicate: [NSPredicate predicateWithBlock: ^BOOL (NSDictionary *call, NSDictionary *bindings) {
1541- return [call[@" context" ] isEqualToNumber: currentExecutorID];
1542- }]];
1529+ RCTProfileImmediateEvent (@" JS Thread Tick" , displayLink.timestamp , @" g" );
15431530
1544- RCT_IF_DEV (
1545- RCTProfileImmediateEvent (@" JS Thread Tick" , displayLink.timestamp , @" g" );
1546-
1547- for (NSDictionary *call in calls) {
1548- _RCTProfileEndFlowEvent (call[@" call_id" ]);
1549- }
1550- )
15511531 RCTProfileBeginEvent ();
15521532
15531533 RCTFrameUpdate *frameUpdate = [[RCTFrameUpdate alloc ] initWithDisplayLink: displayLink];
15541534 for (id <RCTFrameUpdateObserver> observer in _frameUpdateObservers) {
15551535 if (![observer respondsToSelector: @selector (isPaused )] || ![observer isPaused ]) {
1556- RCT_IF_DEV (NSString *name = [NSString stringWithFormat: @" [%@ didUpdateFrame:%f ]" , observer, displayLink.timestamp];)
1557- RCTProfileBeginFlowEvent ();
15581536 [self dispatchBlock: ^{
1559- RCTProfileEndFlowEvent ();
1560- RCTProfileBeginEvent ();
15611537 [observer didUpdateFrame: frameUpdate];
1562- RCTProfileEndEvent (name, @" objc_call,fps" , nil );
15631538 } forModule: RCTModuleIDsByName[RCTBridgeModuleNameForClass ([observer class ])]];
15641539 }
15651540 }
15661541
1542+ NSArray *calls = [_scheduledCallbacks.allObjects arrayByAddingObjectsFromArray: _scheduledCalls];
1543+ NSNumber *currentExecutorID = RCTGetExecutorID (_javaScriptExecutor);
1544+ calls = [calls filteredArrayUsingPredicate: [NSPredicate predicateWithBlock: ^BOOL (NSDictionary *call, NSDictionary *bindings) {
1545+ return [call[@" context" ] isEqualToNumber: currentExecutorID];
1546+ }]];
15671547 if (calls.count > 0 ) {
15681548 _scheduledCalls = [[NSMutableArray alloc ] init ];
15691549 _scheduledCallbacks = [[RCTSparseArray alloc ] init ];
15701550 [self _actuallyInvokeAndProcessModule: @" BatchedBridge"
15711551 method: @" processBatch"
1572- arguments: @[[ calls valueForKey: @" js_args " ] ]
1552+ arguments: @[calls]
15731553 context: RCTGetExecutorID (_javaScriptExecutor)];
15741554 }
15751555
0 commit comments