mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-16 18:50:07 +08:00
Introduce non-copyable JSBigString for managing large strings efficiently
Reviewed By: astreet Differential Revision: D3234836 fbshipit-source-id: 2b95b585dc1215988b88cf0d609c778a95b362a1
This commit is contained in:
committed by
Facebook Github Bot 8
parent
f433ed716c
commit
9e9dfd2ac9
@@ -32,6 +32,14 @@ JSValueRef makeJSCException(
|
||||
return JSValueToObject(ctx, exceptionString, NULL);
|
||||
}
|
||||
|
||||
String jsStringFromBigString(const JSBigString& bigstr) {
|
||||
if (bigstr.isAscii()) {
|
||||
return String::createExpectingAscii(bigstr.c_str(), bigstr.size());
|
||||
} else {
|
||||
return String(bigstr.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
JSValueRef evaluateScript(JSContextRef context, JSStringRef script, JSStringRef source) {
|
||||
JSValueRef exn, result;
|
||||
result = JSEvaluateScript(context, script, NULL, source, 0, &exn);
|
||||
|
||||
Reference in New Issue
Block a user