Enqueue events at 60fps + profiling helpers

This commit is contained in:
Tadeu Zagallo
2015-02-27 04:05:35 -08:00
parent ddf8933904
commit e53558d94a
5 changed files with 188 additions and 21 deletions

View File

@@ -1342,6 +1342,37 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
_nextLayoutAnimation = [[RCTLayoutAnimation alloc] initWithDictionary:config callback:callback];
}
- (void)startOrResetInteractionTiming
{
RCT_EXPORT();
NSSet *rootViewTags = [_rootViewTags copy];
[self addUIBlock:^(RCTUIManager *uiManager, RCTSparseArray *viewRegistry) {
for (NSNumber *reactTag in rootViewTags) {
RCTRootView *rootView = viewRegistry[reactTag];
[rootView startOrResetInteractionTiming];
}
}];
}
- (void)endAndResetInteractionTiming:(RCTResponseSenderBlock)onSuccess
onError:(RCTResponseSenderBlock)onError
{
RCT_EXPORT();
NSSet *rootViewTags = [_rootViewTags copy];
[self addUIBlock:^(RCTUIManager *uiManager, RCTSparseArray *viewRegistry) {
NSMutableDictionary *timingData = [[NSMutableDictionary alloc] init];
for (NSNumber *reactTag in rootViewTags) {
RCTRootView *rootView = viewRegistry[reactTag];
if (rootView) {
timingData[reactTag.stringValue] = [rootView endAndResetInteractionTiming];
}
}
onSuccess(@[ timingData ]);
}];
}
static UIView *_jsResponder;
+ (UIView *)JSResponder