Append D3126321
Reviewed By: javache Differential Revision: D3126614 fb-gh-sync-id: b36bb5eaa306823dce4bd7276f2dd63a2e5cb759 fbshipit-source-id: b36bb5eaa306823dce4bd7276f2dd63a2e5cb759
This commit is contained in:
parent
55920c2444
commit
b57d90a479
|
@ -16,6 +16,7 @@ typedef NS_ENUM(NSUInteger, RCTPLTag) {
|
|||
RCTPLScriptExecution,
|
||||
RCTPLRAMBundleLoad,
|
||||
RCTPLRAMStartupCodeSize,
|
||||
RCTPLRAMNativeRequires,
|
||||
RCTPLRAMNativeRequiresCount,
|
||||
RCTPLRAMNativeRequiresSize,
|
||||
RCTPLNativeModuleInit,
|
||||
|
|
|
@ -89,6 +89,7 @@ NSArray *RCTPerformanceLoggerLabels(void)
|
|||
@"ScriptExecution",
|
||||
@"RAMBundleLoad",
|
||||
@"RAMStartupCodeSize",
|
||||
@"RAMNativeRequires",
|
||||
@"RAMNativeRequiresCount",
|
||||
@"RAMNativeRequiresSize",
|
||||
@"NativeModuleInit",
|
||||
|
|
|
@ -678,8 +678,10 @@ static int readBundle(FILE *fd, size_t offset, size_t length, void *ptr) {
|
|||
|
||||
- (void)registerNativeRequire
|
||||
{
|
||||
RCTPerformanceLoggerSet(RCTPLRAMNativeRequires, 0);
|
||||
RCTPerformanceLoggerSet(RCTPLRAMNativeRequiresCount, 0);
|
||||
RCTPerformanceLoggerSet(RCTPLRAMNativeRequiresSize, 0);
|
||||
|
||||
__weak RCTJSCExecutor *weakSelf = self;
|
||||
[self addSynchronousHookWithName:@"nativeRequire" usingBlock:^(NSString *moduleName) {
|
||||
RCTJSCExecutor *strongSelf = weakSelf;
|
||||
|
@ -687,8 +689,13 @@ static int readBundle(FILE *fd, size_t offset, size_t length, void *ptr) {
|
|||
return;
|
||||
}
|
||||
|
||||
RCTPerformanceLoggerAdd(RCTPLRAMNativeRequiresCount, 1);
|
||||
RCTPerformanceLoggerAppendStart(RCTPLRAMNativeRequires);
|
||||
RCT_PROFILE_BEGIN_EVENT(0, [@"nativeRequire_" stringByAppendingString:moduleName], nil);
|
||||
|
||||
ModuleData *data = (ModuleData *)CFDictionaryGetValue(strongSelf->_jsModules, moduleName.UTF8String);
|
||||
RCTPerformanceLoggerAdd(RCTPLRAMNativeRequiresSize, data->length);
|
||||
|
||||
char bytes[data->length];
|
||||
if (readBundle(strongSelf->_bundle, data->offset, data->length, bytes) != 0) {
|
||||
RCTFatal(RCTErrorWithMessage(@"Error loading RAM module"));
|
||||
|
@ -700,10 +707,9 @@ static int readBundle(FILE *fd, size_t offset, size_t length, void *ptr) {
|
|||
|
||||
CFDictionaryRemoveValue(strongSelf->_jsModules, moduleName.UTF8String);
|
||||
JSStringRelease(code);
|
||||
RCT_PROFILE_END_EVENT(0, @"js_call", nil);
|
||||
|
||||
RCTPerformanceLoggerAdd(RCTPLRAMNativeRequiresCount, 1);
|
||||
RCTPerformanceLoggerAdd(RCTPLRAMNativeRequiresSize, data->length);
|
||||
RCT_PROFILE_END_EVENT(0, @"js_call", nil);
|
||||
RCTPerformanceLoggerAppendEnd(RCTPLRAMNativeRequires);
|
||||
|
||||
if (!result) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
|
Loading…
Reference in New Issue