mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 15:45:32 +00:00
Restore VSYNC markers on RCTProfile
Summary: public The VSYNC markers got lost at some point when refactoring RCTBatchedBridge, restore it, but keep it in RCTProfile. Reviewed By: jspahrsummers Differential Revision: D2685805 fb-gh-sync-id: 1acad330de7baf004a83b41f90ba4b6532605de6
This commit is contained in:
parent
3afa8b6c5f
commit
659cc005ad
@ -46,6 +46,7 @@ static NSDictionary *RCTProfileInfo;
|
||||
static NSMutableDictionary *RCTProfileOngoingEvents;
|
||||
static NSTimeInterval RCTProfileStartTime;
|
||||
static NSUInteger RCTProfileEventID = 0;
|
||||
static CADisplayLink *RCTProfileDisplayLink;
|
||||
|
||||
#pragma mark - Macros
|
||||
|
||||
@ -266,6 +267,19 @@ void RCTProfileUnhookModules(RCTBridge *bridge)
|
||||
dispatch_group_leave(RCTProfileGetUnhookGroup());
|
||||
}
|
||||
|
||||
#pragma mark - Private ObjC class only used for the vSYNC CADisplayLink target
|
||||
|
||||
@interface RCTProfile : NSObject
|
||||
@end
|
||||
|
||||
@implementation RCTProfile
|
||||
|
||||
+ (void)vsync:(__unused CADisplayLink *)displayLink
|
||||
{
|
||||
RCTProfileImmediateEvent(0, @"VSYNC", 'g');
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - Public Functions
|
||||
|
||||
@ -312,6 +326,11 @@ void RCTProfileInit(RCTBridge *bridge)
|
||||
|
||||
RCTProfileHookModules(bridge);
|
||||
|
||||
RCTProfileDisplayLink = [CADisplayLink displayLinkWithTarget:[RCTProfile class]
|
||||
selector:@selector(vsync:)];
|
||||
[RCTProfileDisplayLink addToRunLoop:[NSRunLoop mainRunLoop]
|
||||
forMode:NSRunLoopCommonModes];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTProfileDidStartProfiling
|
||||
object:nil];
|
||||
}
|
||||
@ -329,6 +348,9 @@ void RCTProfileEnd(RCTBridge *bridge, void (^callback)(NSString *))
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTProfileDidEndProfiling
|
||||
object:nil];
|
||||
|
||||
[RCTProfileDisplayLink invalidate];
|
||||
RCTProfileDisplayLink = nil;
|
||||
|
||||
RCTProfileUnhookModules(bridge);
|
||||
|
||||
if (callbacks != NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user