Cleanup and document Value wrapper (retry)

Reviewed By: mhorowitz

Differential Revision: D5120975

fbshipit-source-id: 6e9c80a57fdcf7f3dad21d5521fb928b52c924c7
This commit is contained in:
Pieter De Baets
2017-05-26 03:43:20 -07:00
committed by Facebook Github Bot
parent 11424a8bc6
commit 03e1f40c1e
7 changed files with 158 additions and 146 deletions

View File

@@ -14,6 +14,7 @@
#import <Foundation/Foundation.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTCxxUtils.h>
#import <React/RCTLog.h>
#import <cxxreact/Platform.h>
#import <jschelpers/Value.h>
@@ -30,8 +31,9 @@ JSValueRef nativeLoggingHook(
level = MAX(level, (RCTLogLevel)Value(ctx, arguments[1]).asNumber());
}
if (argumentCount > 0) {
String message = Value(ctx, arguments[0]).toString();
_RCTLogJavaScriptInternal(level, @(message.str().c_str()));
JSContext *contextObj = contextForGlobalContextRef(JSC_JSContextGetGlobalContext(ctx));
JSValue *msg = [JSC_JSValue(ctx) valueWithJSValueRef:arguments[0] inContext:contextObj];
_RCTLogJavaScriptInternal(level, [msg toString]);
}
return Value::makeUndefined(ctx);
}
@@ -45,7 +47,7 @@ JSValueRef nativePerformanceNow(
}
void RCTPrepareJSCExecutor() {
ReactMarker::logTaggedMarker = [](const ReactMarker::ReactMarkerId, const char* tag) {};
ReactMarker::logTaggedMarker = [](const ReactMarker::ReactMarkerId, const char *tag) {};
PerfLogging::installNativeHooks = RCTFBQuickPerformanceLoggerConfigureHooks;
JSNativeHooks::loggingHook = nativeLoggingHook;
JSNativeHooks::nowHook = nativePerformanceNow;