From 56a42e57d05ff609e8fce35dcb5e9db7938db801 Mon Sep 17 00:00:00 2001 From: Alex Dvornikov Date: Tue, 26 Dec 2017 14:34:05 -0800 Subject: [PATCH] remove "prepareReact" call from the iOS bridge Reviewed By: alexeylang Differential Revision: D6581907 fbshipit-source-id: ca4bd4beef6d75305133a2b2c7de62e65e5aa3da --- React/CxxBridge/RCTCxxBridge.mm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 74eef66ed..4bfbe9926 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -739,6 +739,8 @@ struct RCTInstanceCallback : public InstanceCallback { { // 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]; @@ -1013,16 +1015,19 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR } } -- (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.