From 3805bf9e12311429aea6d3783d8c18648f0ca630 Mon Sep 17 00:00:00 2001 From: Alexey Lang Date: Tue, 21 Jun 2016 12:02:31 -0700 Subject: [PATCH] Replace RCT_DEV with RCT_PROFILE Reviewed By: javache Differential Revision: D3462735 fbshipit-source-id: 44513a9540b3111e036c4b14e0fda2d34b43cdf6 --- Libraries/Utilities/MessageQueue.js | 6 ++++-- React/Executors/RCTJSCExecutor.mm | 18 +++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Libraries/Utilities/MessageQueue.js b/Libraries/Utilities/MessageQueue.js index bbc9b4920e9456..8b15a8eddfea72 100644 --- a/Libraries/Utilities/MessageQueue.js +++ b/Libraries/Utilities/MessageQueue.js @@ -151,8 +151,10 @@ class MessageQueue { this._callbacks[this._callbackID++] = onSucc; } - global.nativeTraceBeginAsyncFlow && - global.nativeTraceBeginAsyncFlow(TRACE_TAG_REACT_APPS, 'native', this._callID); + if (__DEV__) { + global.nativeTraceBeginAsyncFlow && + global.nativeTraceBeginAsyncFlow(TRACE_TAG_REACT_APPS, 'native', this._callID); + } this._callID++; this._queue[MODULE_IDS].push(module); diff --git a/React/Executors/RCTJSCExecutor.mm b/React/Executors/RCTJSCExecutor.mm index b0f6e36475a438..198469358d0bd2 100644 --- a/React/Executors/RCTJSCExecutor.mm +++ b/React/Executors/RCTJSCExecutor.mm @@ -452,6 +452,15 @@ - (void)setUp } }]; + for (NSString *event in @[RCTProfileDidStartProfiling, RCTProfileDidEndProfiling]) { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(toggleProfilingFlag:) + name:event + object:nil]; + } +#endif + +#if RCT_DEV [self executeBlockOnJavaScriptQueue:^{ RCTJSCExecutor *strongSelf = weakSelf; if (!strongSelf.valid) { @@ -462,15 +471,6 @@ - (void)setUp RCTInstallJSCProfiler(_bridge, context.JSGlobalContextRef); }]; - for (NSString *event in @[RCTProfileDidStartProfiling, RCTProfileDidEndProfiling]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(toggleProfilingFlag:) - name:event - object:nil]; - } -#endif - -#if RCT_DEV // Inject handler used by HMR [self addSynchronousHookWithName:@"nativeInjectHMRUpdate" usingBlock:^(NSString *sourceCode, NSString *sourceCodeURL) { RCTJSCExecutor *strongSelf = weakSelf;