Skip to content

Commit

Permalink
remove "prepareReact" call from the iOS bridge
Browse files Browse the repository at this point in the history
Reviewed By: alexeylang

Differential Revision: D6581907

fbshipit-source-id: ca4bd4beef6d75305133a2b2c7de62e65e5aa3da
  • Loading branch information
fromcelticpark authored and facebook-github-bot committed Dec 26, 2017
1 parent 33a2e53 commit 56a42e5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions React/CxxBridge/RCTCxxBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,8 @@ - (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync
{
// This will get called from whatever thread was actually executing JS.
dispatch_block_t completion = ^{
// Log start up metrics early before processing any other js calls
[self logStartupFinish];
// Flush pending calls immediately so we preserve ordering
[self _flushPendingCalls];

Expand Down Expand Up @@ -1013,16 +1015,19 @@ - (void)_runAfterLoad:(RCTPendingCall)block
}
}

- (void)_flushPendingCalls
- (void)logStartupFinish
{
// Log metrics about native requires during the bridge startup.
uint64_t nativeRequiresCount = [self->_performanceLogger valueForTag:RCTPLRAMNativeRequiresCount];
uint64_t nativeRequiresCount = [_performanceLogger valueForTag:RCTPLRAMNativeRequiresCount];
[_performanceLogger setValue:nativeRequiresCount forTag:RCTPLRAMStartupNativeRequiresCount];
uint64_t nativeRequires = [self->_performanceLogger valueForTag:RCTPLRAMNativeRequires];
uint64_t nativeRequires = [_performanceLogger valueForTag:RCTPLRAMNativeRequires];
[_performanceLogger setValue:nativeRequires forTag:RCTPLRAMStartupNativeRequires];

[_performanceLogger markStopForTag:RCTPLBridgeStartup];
}

- (void)_flushPendingCalls
{
RCT_PROFILE_BEGIN_EVENT(0, @"Processing pendingCalls", @{ @"count": [@(_pendingCalls.count) stringValue] });
// Phase B: _flushPendingCalls happens. Each block in _pendingCalls is
// executed, adding work to the queue, and _pendingCount is decremented.
Expand Down

0 comments on commit 56a42e5

Please sign in to comment.