Add JSContextRef param to String constructor

Reviewed By: bnham

Differential Revision: D4197300

fbshipit-source-id: 306ffc85e3ced24047b68499f7cdf5e2d31fc052
This commit is contained in:
Pieter De Baets
2016-11-18 06:28:48 -08:00
committed by Facebook Github Bot
parent b1c91606ff
commit 20514e3482
13 changed files with 75 additions and 78 deletions
+6 -7
View File
@@ -29,13 +29,12 @@ static JSValueRef nativeProfilerStart(
return Value::makeUndefined(ctx);
}
JSStringRef title = JSValueToStringCopy(ctx, arguments[0], exception);
auto title = String::adopt(ctx, JSValueToStringCopy(ctx, arguments[0], exception));
#if WITH_REACT_INTERNAL_SETTINGS
JSStartProfiling(ctx, title, false);
#else
JSStartProfiling(ctx, title);
#endif
JSStringRelease(title);
return Value::makeUndefined(ctx);
}
@@ -57,15 +56,15 @@ static JSValueRef nativeProfilerEnd(
std::string writeLocation("/sdcard/");
if (argumentCount > 1) {
JSStringRef fileName = JSValueToStringCopy(ctx, arguments[1], exception);
writeLocation += facebook::react::String::ref(fileName).str();
JSStringRelease(fileName);
auto fileName = String::adopt(
ctx, JSValueToStringCopy(ctx, arguments[1], exception));
writeLocation += fileName.str();
} else {
writeLocation += "profile.json";
}
JSStringRef title = JSValueToStringCopy(ctx, arguments[0], exception);
auto title = String::adopt(
ctx, JSValueToStringCopy(ctx, arguments[0], exception));
JSEndProfilingAndRender(ctx, title, writeLocation.c_str());
JSStringRelease(title);
return Value::makeUndefined(ctx);
}