Support QuickPerformanceLogger.js in the old bridge

Reviewed By: javache

Differential Revision: D4566647

fbshipit-source-id: 1a6448b89b14f4ce9f2192e9f7b4e28b8dcb52b7
This commit is contained in:
Alexey Lang 2017-02-16 11:30:39 -08:00 committed by Facebook Github Bot
parent c27c45cd45
commit 7c97008fa8
2 changed files with 27 additions and 0 deletions

View File

@ -51,6 +51,28 @@ var QuickPerformanceLogger = {
} }
}, },
markerTag(markerId, tag, opts) {
if (typeof markerId !== 'number' || typeof tag !== 'string') {
return;
}
if (global.nativeQPLMarkerTag) {
opts = fixOpts(opts);
global.nativeQPLMarkerTag(markerId, opts.instanceKey, tag);
}
},
markerAnnotate(markerId, annotationKey, annotationValue, opts) {
if (typeof markerId !== 'number' ||
typeof annotationKey !== 'string' ||
typeof annotationValue !== 'string') {
return;
}
if (global.nativeQPLMarkerAnnotate) {
opts = fixOpts(opts);
global.nativeQPLMarkerAnnotate(markerId, opts.instanceKey, annotationKey, annotationValue);
}
},
markerCancel(markerId, opts) { markerCancel(markerId, opts) {
if (typeof markerId !== 'number') { if (typeof markerId !== 'number') {
return; return;

View File

@ -40,6 +40,9 @@ RCT_EXTERN NSString *const RCTFBJSValueClassKey = @"_RCTFBJSValueClassKey";
static NSString *const RCTJSCProfilerEnabledDefaultsKey = @"RCTJSCProfilerEnabled"; static NSString *const RCTJSCProfilerEnabledDefaultsKey = @"RCTJSCProfilerEnabled";
__attribute__((weak)) void RCTFBQuickPerformanceLoggerConfigureHooks(JSContext *context);
void RCTFBQuickPerformanceLoggerConfigureHooks(JSContext *context) { }
struct __attribute__((packed)) ModuleData { struct __attribute__((packed)) ModuleData {
uint32_t offset; uint32_t offset;
uint32_t size; uint32_t size;
@ -356,6 +359,8 @@ static NSThread *newJavaScriptThread(void)
threadDictionary[RCTFBJSValueClassKey] = JSC_JSValue(contextRef); threadDictionary[RCTFBJSValueClassKey] = JSC_JSValue(contextRef);
} }
RCTFBQuickPerformanceLoggerConfigureHooks(context);
__weak RCTJSCExecutor *weakSelf = self; __weak RCTJSCExecutor *weakSelf = self;
context[@"nativeRequireModuleConfig"] = ^NSArray *(NSString *moduleName) { context[@"nativeRequireModuleConfig"] = ^NSArray *(NSString *moduleName) {
RCTJSCExecutor *strongSelf = weakSelf; RCTJSCExecutor *strongSelf = weakSelf;