-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
48198 node api external strings #48339
48198 node api external strings #48339
Conversation
Review requested:
|
src/js_native_api_v8.cc
Outdated
|
||
napi_status NAPI_CDECL node_api_create_external_string_utf16( | ||
napi_env env, const char16_t* str, size_t length, napi_value* result) { | ||
#if defined(V8_ENABLE_SANDBOX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check with Electron if this is needed for strings.
src/js_native_api_v8.cc
Outdated
class ExternalOneByteStringResource | ||
: public v8::String::ExternalOneByteStringResource { | ||
public: | ||
ExternalOneByteStringResource(const char* string, const size_t length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it OK if lengh
is NAPI_AUTO_LENGTH
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chose to assume that it is not, and used C++ string view to compute length.
cf6e959
to
20ab0fb
Compare
Co-authored-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
Co-authored-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
Introduce APIs that allow for the creation of JavaScript strings without copying the underlying native string into the engine. The APIs fall back to regular string creation if the engine's external string APIs are unavailable. In this case, an optional boolean out-parameter indicates that the string was copied, and the optional finalizer is called if given. PR-URL: #48339 Fixes: #48198 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com>
Landed in 60d9aed. |
Introduce APIs that allow for the creation of JavaScript strings without copying the underlying native string into the engine. The APIs fall back to regular string creation if the engine's external string APIs are unavailable. In this case, an optional boolean out-parameter indicates that the string was copied, and the optional finalizer is called if given. PR-URL: #48339 Fixes: #48198 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com>
Introduce APIs that allow for the creation of JavaScript strings without copying the underlying native string into the engine. The APIs fall back to regular string creation if the engine's external string APIs are unavailable. In this case, an optional boolean out-parameter indicates that the string was copied, and the optional finalizer is called if given. PR-URL: nodejs#48339 Fixes: nodejs#48198 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com>
Introduce APIs that allow for the creation of JavaScript strings without copying the underlying native string into the engine. The APIs fall back to regular string creation if the engine's external string APIs are unavailable. In this case, an optional boolean out-parameter indicates that the string was copied, and the optional finalizer is called if given. PR-URL: nodejs#48339 Fixes: nodejs#48198 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com>
Introduce APIs that allow for the creation of JavaScript strings without copying the underlying native string into the engine. The APIs fall back to regular string creation if the engine's external string APIs are unavailable. In this case, an optional boolean out-parameter indicates that the string was copied, and the optional finalizer is called if given. PR-URL: #48339 Fixes: #48198 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com>
Introduce APIs that allow for the creation of JavaScript strings without copying the underlying native string into the engine. The APIs fall back to regular string creation if the engine's external string APIs are unavailable. In this case, an optional boolean out-parameter indicates that the string was copied, and the optional finalizer is called if given. PR-URL: #48339 Fixes: #48198 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com>
No description provided.