Permalink
Browse files

Support QuickPerformanceLogger.js in CxxBridge

Reviewed By: javache

Differential Revision: D4573567

fbshipit-source-id: 3ef9da38fb178cf4c1400b4a991a9e85f3ec3755
  • Loading branch information...
alexeylang authored and facebook-github-bot committed Feb 17, 2017
1 parent e29ba72 commit ba029becbeddc674514c565c663d597f5b328ff2
@@ -7,13 +7,17 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <JavaScriptCore/JSBase.h>
#import <React/RCTBridge.h>
@class RCTModuleData;
@protocol RCTJavaScriptExecutor;
RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
RCT_EXTERN __attribute__((weak)) void RCTFBQuickPerformanceLoggerConfigureHooks(JSGlobalContextRef ctx);
#if RCT_DEBUG
RCT_EXTERN void RCTVerifyAllModulesExported(NSArray *extraModules);
#endif
View
@@ -32,6 +32,8 @@
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 @@ + (void)initialize
{
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 @@
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 @@ - (void)setUp
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);

0 comments on commit ba029be

Please sign in to comment.