mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-27 22:54:46 +08:00
Avoid dispatch_async on RCTProfile when not profiling
Summary: public Fixes #3953 Bail out soon when the profiler is not running + move string formating into the macro so that it happens in a background queue. Reviewed By: jspahrsummers Differential Revision: D2696167 fb-gh-sync-id: a1b91ee4459078ab9a4c0be62bd23362ec05e208
This commit is contained in:
committed by
facebook-github-bot-0
parent
9365414559
commit
ea96a7edb8
@@ -871,12 +871,11 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
||||
for (RCTModuleData *moduleData in _frameUpdateObservers) {
|
||||
id<RCTFrameUpdateObserver> observer = (id<RCTFrameUpdateObserver>)moduleData.instance;
|
||||
if (!observer.paused) {
|
||||
RCT_IF_DEV(NSString *name = [NSString stringWithFormat:@"[%@ didUpdateFrame:%f]", observer, displayLink.timestamp];)
|
||||
RCTProfileBeginFlowEvent();
|
||||
|
||||
[self dispatchBlock:^{
|
||||
RCTProfileEndFlowEvent();
|
||||
RCT_PROFILE_BEGIN_EVENT(0, name, nil);
|
||||
RCT_PROFILE_BEGIN_EVENT(0, [NSString stringWithFormat:@"[%@ didUpdateFrame:%f]", observer, displayLink.timestamp], nil);
|
||||
[observer didUpdateFrame:frameUpdate];
|
||||
RCT_PROFILE_END_EVENT(0, @"objc_call,fps", nil);
|
||||
} queue:moduleData.methodQueue];
|
||||
|
||||
Reference in New Issue
Block a user