perf: use ArrayBuffer::Data() instead of GetBackingStore()->Data() (#44067)
perf: use ArrayBuffer::Data() API Replace our `GetBackingStore()->Data()` calls with this instead. Explained by the V8 docs, ArrayBuffer.Data() is > More efficient shortcut for GetBackingStore()->Data(). The > returned pointer is valid as long as the ArrayBuffer is alive.
This commit is contained in:
parent
f828c1da09
commit
6f88f0c795
2 changed files with 2 additions and 5 deletions
|
@ -713,8 +713,7 @@ void SimpleURLLoaderWrapper::OnDataReceived(std::string_view string_view,
|
|||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
auto array_buffer = v8::ArrayBuffer::New(isolate, string_view.size());
|
||||
auto backing_store = array_buffer->GetBackingStore();
|
||||
memcpy(backing_store->Data(), string_view.data(), string_view.size());
|
||||
memcpy(array_buffer->Data(), string_view.data(), string_view.size());
|
||||
Emit("data", array_buffer,
|
||||
base::AdaptCallbackForRepeating(std::move(resume)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue