aboutsummaryrefslogtreecommitdiff
path: root/src/inspector/main_thread_interface.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-10-19 00:53:38 +0200
committerAnna Henningsen <anna@addaleax.net>2019-10-23 23:13:30 +0200
commit7a82e5ee62e5a3a29059581f208d960ff3ec8696 (patch)
treed2d545b046e7873fb4a4ec4959df2a97b26fa693 /src/inspector/main_thread_interface.h
parent5a042a6b1a9763be010c4614436b114f0d514561 (diff)
downloadandroid-node-v8-7a82e5ee62e5a3a29059581f208d960ff3ec8696.tar.gz
android-node-v8-7a82e5ee62e5a3a29059581f208d960ff3ec8696.tar.bz2
android-node-v8-7a82e5ee62e5a3a29059581f208d960ff3ec8696.zip
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/main_thread_interface.h')
-rw-r--r--src/inspector/main_thread_interface.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/inspector/main_thread_interface.h b/src/inspector/main_thread_interface.h
index 9a48192cd3..bcea19f3f3 100644
--- a/src/inspector/main_thread_interface.h
+++ b/src/inspector/main_thread_interface.h
@@ -70,7 +70,8 @@ class MainThreadHandle : public std::enable_shared_from_this<MainThreadHandle> {
friend class MainThreadInterface;
};
-class MainThreadInterface {
+class MainThreadInterface :
+ public std::enable_shared_from_this<MainThreadInterface> {
public:
MainThreadInterface(Agent* agent, uv_loop_t*, v8::Isolate* isolate,
v8::Platform* platform);