Support QuickPerformanceLogger.js in CxxBridge
Reviewed By: javache Differential Revision: D4573567 fbshipit-source-id: 3ef9da38fb178cf4c1400b4a991a9e85f3ec3755
This commit is contained in:
parent
e29ba72ba7
commit
ba029becbe
|
@ -7,6 +7,8 @@
|
|||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <JavaScriptCore/JSBase.h>
|
||||
|
||||
#import <React/RCTBridge.h>
|
||||
|
||||
@class RCTModuleData;
|
||||
|
@ -14,6 +16,8 @@
|
|||
|
||||
RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
|
||||
|
||||
RCT_EXTERN __attribute__((weak)) void RCTFBQuickPerformanceLoggerConfigureHooks(JSGlobalContextRef ctx);
|
||||
|
||||
#if RCT_DEBUG
|
||||
RCT_EXTERN void RCTVerifyAllModulesExported(NSArray *extraModules);
|
||||
#endif
|
||||
|
|
|
@ -32,6 +32,8 @@ NSArray<Class> *RCTGetModuleClasses(void)
|
|||
return RCTModuleClasses;
|
||||
}
|
||||
|
||||
void RCTFBQuickPerformanceLoggerConfigureHooks(__unused JSGlobalContextRef ctx) { }
|
||||
|
||||
/**
|
||||
* Register the given class as a bridge module. All modules must be registered
|
||||
* prior to the first bridge initialization.
|
||||
|
|
|
@ -244,7 +244,7 @@ struct RCTInstanceCallback : public InstanceCallback {
|
|||
{
|
||||
if (self == [RCTCxxBridge class]) {
|
||||
ReactMarker::logMarker = [](const std::string&) {};
|
||||
PerfLogging::installNativeHooks = [](JSGlobalContextRef){};
|
||||
PerfLogging::installNativeHooks = RCTFBQuickPerformanceLoggerConfigureHooks;
|
||||
JSNativeHooks::loggingHook = nativeLoggingHook;
|
||||
JSNativeHooks::nowHook = nativePerformanceNow;
|
||||
}
|
||||
|
|
|
@ -40,9 +40,6 @@ RCT_EXTERN NSString *const RCTFBJSValueClassKey = @"_RCTFBJSValueClassKey";
|
|||
|
||||
static NSString *const RCTJSCProfilerEnabledDefaultsKey = @"RCTJSCProfilerEnabled";
|
||||
|
||||
__attribute__((weak)) void RCTFBQuickPerformanceLoggerConfigureHooks(JSContext *context);
|
||||
void RCTFBQuickPerformanceLoggerConfigureHooks(JSContext *context) { }
|
||||
|
||||
struct __attribute__((packed)) ModuleData {
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
|
@ -344,7 +341,7 @@ static NSThread *newJavaScriptThread(void)
|
|||
threadDictionary[RCTFBJSValueClassKey] = JSC_JSValue(contextRef);
|
||||
}
|
||||
|
||||
RCTFBQuickPerformanceLoggerConfigureHooks(context);
|
||||
RCTFBQuickPerformanceLoggerConfigureHooks(context.JSGlobalContextRef);
|
||||
|
||||
__weak RCTJSCExecutor *weakSelf = self;
|
||||
context[@"nativeRequireModuleConfig"] = ^NSArray *(NSString *moduleName) {
|
||||
|
|
|
@ -279,9 +279,10 @@ void JSCExecutor::initOnJSVMThread() throw(JSException) {
|
|||
#ifdef WITH_JSC_EXTRA_TRACING
|
||||
addNativeProfilingHooks(m_context);
|
||||
addNativeTracingLegacyHooks(m_context);
|
||||
PerfLogging::installNativeHooks(m_context);
|
||||
#endif
|
||||
|
||||
PerfLogging::installNativeHooks(m_context);
|
||||
|
||||
#if defined(__APPLE__) || defined(WITH_JSC_EXTRA_TRACING)
|
||||
if (JSC_JSSamplingProfilerEnabled(m_context)) {
|
||||
initSamplingProfilerOnMainJSCThread(m_context);
|
||||
|
|
Loading…
Reference in New Issue