mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-12 22:39:06 +08:00
Add some more helper methods to Value
Reviewed By: mhorowitz Differential Revision: D4197278 fbshipit-source-id: 9a538ff2747d32a54d42627a9f78e4a348dce639
This commit is contained in:
committed by
Facebook Github Bot
parent
1604f10889
commit
674d86cdcb
@@ -10,6 +10,8 @@
|
||||
#include <jschelpers/JSCHelpers.h>
|
||||
#include <jschelpers/Value.h>
|
||||
|
||||
using namespace facebook::react;
|
||||
|
||||
static JSValueRef nativeCaptureHeap(
|
||||
JSContextRef ctx,
|
||||
JSObjectRef function,
|
||||
@@ -19,18 +21,18 @@ static JSValueRef nativeCaptureHeap(
|
||||
JSValueRef* exception) {
|
||||
if (argumentCount < 1) {
|
||||
if (exception) {
|
||||
*exception = facebook::react::makeJSCException(
|
||||
*exception = Value::makeError(
|
||||
ctx,
|
||||
"nativeCaptureHeap requires the path to save the capture");
|
||||
}
|
||||
return JSValueMakeUndefined(ctx);
|
||||
return Value::makeUndefined(ctx);
|
||||
}
|
||||
|
||||
JSStringRef outputFilename = JSValueToStringCopy(ctx, arguments[0], exception);
|
||||
std::string finalFilename = facebook::react::String::ref(outputFilename).str();
|
||||
JSCaptureHeap(ctx, finalFilename.c_str(), exception);
|
||||
JSStringRelease(outputFilename);
|
||||
return JSValueMakeUndefined(ctx);
|
||||
return Value::makeUndefined(ctx);
|
||||
}
|
||||
|
||||
#endif // WITH_FB_MEMORY_PROFILING
|
||||
|
||||
Reference in New Issue
Block a user