Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-10-19 01:53:38 +0300
committerAnna Henningsen <anna@addaleax.net>2019-10-24 00:13:30 +0300
commit7a82e5ee62e5a3a29059581f208d960ff3ec8696 (patch)
treed2d545b046e7873fb4a4ec4959df2a97b26fa693 /src/inspector_agent.cc
parent5a042a6b1a9763be010c4614436b114f0d514561 (diff)
inspector: turn platform tasks that outlive Agent into no-ops
Turn tasks scheduled on the `v8::Isolate` or on the given platform into no-ops if the underlying `MainThreadInterface` has gone away before the task could be run (which would happen when the `Environment` instance and with it the `inspector::Agent` instance are destroyed). This addresses an issue that Electron has been having with inspector support, and generally just seems like the right thing to do, as we may not fully be in control of the relative timing of Environment teardown, platform tasksexecution, and the execution of `RequestInterrupt()` callbacks (although the former two always happen in the same order in our own code). PR-URL: https://github.com/nodejs/node/pull/30031 Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/inspector_agent.cc')
-rw-r--r--src/inspector_agent.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index 424b09d6e1d..469e0b4f8f3 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -665,10 +665,10 @@ class NodeInspectorClient : public V8InspectorClient {
}
std::shared_ptr<MainThreadHandle> getThreadHandle() {
- if (interface_ == nullptr) {
- interface_.reset(new MainThreadInterface(
+ if (!interface_) {
+ interface_ = std::make_shared<MainThreadInterface>(
env_->inspector_agent(), env_->event_loop(), env_->isolate(),
- env_->isolate_data()->platform()));
+ env_->isolate_data()->platform());
}
return interface_->GetHandle();
}
@@ -739,7 +739,7 @@ class NodeInspectorClient : public V8InspectorClient {
bool waiting_for_frontend_ = false;
bool waiting_for_sessions_disconnect_ = false;
// Allows accessing Inspector from non-main threads
- std::unique_ptr<MainThreadInterface> interface_;
+ std::shared_ptr<MainThreadInterface> interface_;
std::shared_ptr<WorkerManager> worker_manager_;
};