mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
Change async events' cookie to NSUInteger
Summary: public As jspahrsumemrs pointed out, `int` could overflow pretty easy, since it was static, change it to an NSUInteger and downcast it when need to interop. Reviewed By: jspahrsummers Differential Revision: D2625902 fb-gh-sync-id: 2052be47a7b0ed81484da004fa18d6ef5baf26f7
This commit is contained in:
committed by
facebook-github-bot-6
parent
1f0d48a0e4
commit
e1fa325569
@@ -420,20 +420,20 @@ void _RCTProfileEndEvent(
|
||||
);
|
||||
}
|
||||
|
||||
int RCTProfileBeginAsyncEvent(
|
||||
NSUInteger RCTProfileBeginAsyncEvent(
|
||||
uint64_t tag,
|
||||
NSString *name,
|
||||
NSDictionary *args
|
||||
) {
|
||||
CHECK(0);
|
||||
|
||||
static int eventID = 0;
|
||||
static NSUInteger eventID = 0;
|
||||
|
||||
NSTimeInterval time = CACurrentMediaTime();
|
||||
int currentEventID = ++eventID;
|
||||
NSUInteger currentEventID = ++eventID;
|
||||
|
||||
if (callbacks != NULL) {
|
||||
callbacks->begin_async_section(tag, name.UTF8String, eventID, args.count, RCTProfileSystraceArgsFromNSDictionary(args));
|
||||
callbacks->begin_async_section(tag, name.UTF8String, (int)(currentEventID % INT_MAX), args.count, RCTProfileSystraceArgsFromNSDictionary(args));
|
||||
} else {
|
||||
dispatch_async(RCTProfileGetQueue(), ^{
|
||||
RCTProfileOngoingEvents[@(currentEventID)] = @[
|
||||
@@ -450,14 +450,14 @@ int RCTProfileBeginAsyncEvent(
|
||||
void RCTProfileEndAsyncEvent(
|
||||
uint64_t tag,
|
||||
NSString *category,
|
||||
int cookie,
|
||||
NSUInteger cookie,
|
||||
NSString *name,
|
||||
NSDictionary *args
|
||||
) {
|
||||
CHECK();
|
||||
|
||||
if (callbacks != NULL) {
|
||||
callbacks->end_async_section(tag, name.UTF8String, cookie, args.count, RCTProfileSystraceArgsFromNSDictionary(args));
|
||||
callbacks->end_async_section(tag, name.UTF8String, (int)(cookie % INT_MAX), args.count, RCTProfileSystraceArgsFromNSDictionary(args));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user