-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.c++Issues and PRs that require attention from people who are familiar with C++.Issues and PRs that require attention from people who are familiar with C++.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
Description
The new API is present in V8 7.9, so we can already migrate to it:
Lines 5007 to 5043 in b551c65
/** | |
* Create a new ArrayBuffer with an existing backing store. | |
* The created array keeps a reference to the backing store until the array | |
* is garbage collected. Note that the IsExternal bit does not affect this | |
* reference from the array to the backing store. | |
* | |
* In future IsExternal bit will be removed. Until then the bit is set as | |
* follows. If the backing store does not own the underlying buffer, then | |
* the array is created in externalized state. Otherwise, the array is created | |
* in internalized state. In the latter case the array can be transitioned | |
* to the externalized state using Externalize(backing_store). | |
*/ | |
static Local<ArrayBuffer> New(Isolate* isolate, | |
std::shared_ptr<BackingStore> backing_store); | |
/** | |
* Returns a new standalone BackingStore that is allocated using the array | |
* buffer allocator of the isolate. The result can be later passed to | |
* ArrayBuffer::New. | |
* | |
* If the allocator returns nullptr, then the function may cause GCs in the | |
* given isolate and re-try the allocation. If GCs do not help, then the | |
* function will crash with an out-of-memory error. | |
*/ | |
static std::unique_ptr<BackingStore> NewBackingStore(Isolate* isolate, | |
size_t byte_length); | |
/** | |
* Returns a new standalone BackingStore that takes over the ownership of | |
* the given buffer. The destructor of the BackingStore invokes the given | |
* deleter callback. | |
* | |
* The result can be later passed to ArrayBuffer::New. The raw pointer | |
* to the buffer must not be passed again to any V8 API function. | |
*/ | |
static std::unique_ptr<BackingStore> NewBackingStore( | |
void* data, size_t byte_length, BackingStoreDeleterCallback deleter, | |
void* deleter_data); |
There is an upstream issue to gather feedback: v8:9908.
addaleax and lin7sh
Metadata
Metadata
Assignees
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.c++Issues and PRs that require attention from people who are familiar with C++.Issues and PRs that require attention from people who are familiar with C++.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.