diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-10-22 22:03:53 +0200 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2019-11-08 15:53:36 +0100 |
commit | 2bdeb88c27b4d8de3a8f6b7a438cf0bcb88fa927 (patch) | |
tree | c86c4faa4410216460c25053ab22061ee3f9897f /src/node_worker.cc | |
parent | 2707efd27b5ce5f9b9a6873438769394ef1c6431 (diff) | |
download | android-node-v8-2bdeb88c27b4d8de3a8f6b7a438cf0bcb88fa927.tar.gz android-node-v8-2bdeb88c27b4d8de3a8f6b7a438cf0bcb88fa927.tar.bz2 android-node-v8-2bdeb88c27b4d8de3a8f6b7a438cf0bcb88fa927.zip |
src: remove custom tracking for SharedArrayBuffers
Remove custom tracking for `SharedArrayBuffer`s and their allocators
and instead let V8 do the tracking of both. This is required starting
in V8 7.9, because lifetime management for `ArrayBuffer::Allocator`s
differs from what was performed previously (i.e. it is no longer
easily possible for one Isolate to release an `ArrayBuffer` and another
to accept it into its own allocator), and the alternative would
have been adapting the `SharedArrayBuffer` tracking logic to also
apply to regular `ArrayBuffer` instances.
Refs: https://github.com/nodejs/node/pull/30044
PR-URL: https://github.com/nodejs/node/pull/30020
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/node_worker.cc')
-rw-r--r-- | src/node_worker.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/node_worker.cc b/src/node_worker.cc index 9f2da4c9de..3c604ec2ec 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -51,7 +51,6 @@ Worker::Worker(Environment* env, per_isolate_opts_(per_isolate_opts), exec_argv_(exec_argv), platform_(env->isolate_data()->platform()), - array_buffer_allocator_(ArrayBufferAllocator::Create()), start_profiler_idle_notifier_(env->profiler_idle_notifier_started()), thread_id_(Environment::AllocateThreadId()), env_vars_(env->env_vars()) { @@ -95,10 +94,6 @@ bool Worker::is_stopped() const { return stopped_; } -std::shared_ptr<ArrayBufferAllocator> Worker::array_buffer_allocator() { - return array_buffer_allocator_; -} - void Worker::UpdateResourceConstraints(ResourceConstraints* constraints) { constraints->set_stack_limit(reinterpret_cast<uint32_t*>(stack_base_)); @@ -138,9 +133,11 @@ class WorkerThreadData { : w_(w) { CHECK_EQ(uv_loop_init(&loop_), 0); + std::shared_ptr<ArrayBufferAllocator> allocator = + ArrayBufferAllocator::Create(); Isolate::CreateParams params; SetIsolateCreateParamsForNode(¶ms); - params.array_buffer_allocator = w->array_buffer_allocator_.get(); + params.array_buffer_allocator_shared = allocator; w->UpdateResourceConstraints(¶ms.constraints); @@ -164,7 +161,7 @@ class WorkerThreadData { isolate_data_.reset(CreateIsolateData(isolate, &loop_, w_->platform_, - w->array_buffer_allocator_.get())); + allocator.get())); CHECK(isolate_data_); if (w_->per_isolate_opts_) isolate_data_->set_options(std::move(w_->per_isolate_opts_)); |