Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8a79636

Browse filesBrowse files
kvakildanielleadams
authored andcommitted
src: remove usages of GetBackingStore in node-api
This removes all usages of GetBackingStore in `node-api`. See the linked issue for an explanation. Refs: #32226 Refs: #43921 PR-URL: #44075 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 34a92d1 commit 8a79636
Copy full SHA for 8a79636

File tree

Expand file treeCollapse file tree

1 file changed

+8
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-11
lines changed
Open diff view settings
Collapse file

‎src/js_native_api_v8.cc‎

Copy file name to clipboardExpand all lines: src/js_native_api_v8.cc
+8-11Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2780,7 +2780,7 @@ napi_status NAPI_CDECL napi_create_arraybuffer(napi_env env,
27802780
// Optionally return a pointer to the buffer's data, to avoid another call to
27812781
// retrieve it.
27822782
if (data != nullptr) {
2783-
*data = buffer->GetBackingStore()->Data();
2783+
*data = buffer->Data();
27842784
}
27852785

27862786
*result = v8impl::JsValueFromV8LocalValue(buffer);
@@ -2814,15 +2814,14 @@ napi_status NAPI_CDECL napi_get_arraybuffer_info(napi_env env,
28142814
v8::Local<v8::Value> value = v8impl::V8LocalValueFromJsValue(arraybuffer);
28152815
RETURN_STATUS_IF_FALSE(env, value->IsArrayBuffer(), napi_invalid_arg);
28162816

2817-
std::shared_ptr<v8::BackingStore> backing_store =
2818-
value.As<v8::ArrayBuffer>()->GetBackingStore();
2817+
v8::Local<v8::ArrayBuffer> ab = value.As<v8::ArrayBuffer>();
28192818

28202819
if (data != nullptr) {
2821-
*data = backing_store->Data();
2820+
*data = ab->Data();
28222821
}
28232822

28242823
if (byte_length != nullptr) {
2825-
*byte_length = backing_store->ByteLength();
2824+
*byte_length = ab->ByteLength();
28262825
}
28272826

28282827
return napi_clear_last_error(env);
@@ -2963,8 +2962,7 @@ napi_status NAPI_CDECL napi_get_typedarray_info(napi_env env,
29632962
}
29642963

29652964
if (data != nullptr) {
2966-
*data = static_cast<uint8_t*>(buffer->GetBackingStore()->Data()) +
2967-
array->ByteOffset();
2965+
*data = static_cast<uint8_t*>(buffer->Data()) + array->ByteOffset();
29682966
}
29692967

29702968
if (arraybuffer != nullptr) {
@@ -3044,8 +3042,7 @@ napi_status NAPI_CDECL napi_get_dataview_info(napi_env env,
30443042
}
30453043

30463044
if (data != nullptr) {
3047-
*data = static_cast<uint8_t*>(buffer->GetBackingStore()->Data()) +
3048-
array->ByteOffset();
3045+
*data = static_cast<uint8_t*>(buffer->Data()) + array->ByteOffset();
30493046
}
30503047

30513048
if (arraybuffer != nullptr) {
@@ -3255,8 +3252,8 @@ napi_status NAPI_CDECL napi_is_detached_arraybuffer(napi_env env,
32553252

32563253
v8::Local<v8::Value> value = v8impl::V8LocalValueFromJsValue(arraybuffer);
32573254

3258-
*result = value->IsArrayBuffer() &&
3259-
value.As<v8::ArrayBuffer>()->GetBackingStore()->Data() == nullptr;
3255+
*result =
3256+
value->IsArrayBuffer() && value.As<v8::ArrayBuffer>()->Data() == nullptr;
32603257

32613258
return napi_clear_last_error(env);
32623259
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.