diff --git a/React/Profiler/RCTProfile.h b/React/Profiler/RCTProfile.h index b0e9cecdb..e47728e2b 100644 --- a/React/Profiler/RCTProfile.h +++ b/React/Profiler/RCTProfile.h @@ -187,6 +187,9 @@ typedef struct { void (*end_async_section)(uint64_t tag, const char *name, int cookie, size_t numArgs, systrace_arg_t *args); void (*instant_section)(uint64_t tag, const char *name, char scope); + + void (*begin_async_flow)(uint64_t tag, const char *name, int cookie); + void (*end_async_flow)(uint64_t tag, const char *name, int cookie); } RCTProfileCallbacks; RCT_EXTERN void RCTProfileRegisterCallbacks(RCTProfileCallbacks *); diff --git a/React/Profiler/RCTProfile.m b/React/Profiler/RCTProfile.m index 6599faea3..56ba31dc8 100644 --- a/React/Profiler/RCTProfile.m +++ b/React/Profiler/RCTProfile.m @@ -696,13 +696,15 @@ NSNumber *_RCTProfileBeginFlowEvent(void) CHECK(@0); + unsigned int cookie = ++flowID; + NSNumber *currentID = @(cookie); + if (callbacks != NULL) { - // flow events not supported yet - return @0; + callbacks->begin_async_flow(1, "flow", cookie); + return currentID; } NSTimeInterval time = CACurrentMediaTime(); - NSNumber *currentID = @(++flowID); NSString *threadName = RCTCurrentThreadName(); dispatch_async(RCTProfileGetQueue(), ^{ @@ -725,6 +727,7 @@ void _RCTProfileEndFlowEvent(NSNumber *flowID) CHECK(); if (callbacks != NULL) { + callbacks->end_async_flow(1, "flow", [flowID integerValue]); return; }