diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-03-22 21:04:57 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-04-10 18:47:14 +0300 |
commit | 6f9f546406820dc9e233380e061081c9bcd1de0b (patch) | |
tree | 7140f3b3469890956a326044e1f90da4153117e2 /src/inspector_agent.h | |
parent | 32e3a6bb87f2f88b8f54ff9e9f216aa5f5f0a647 (diff) |
src: use env->RequestInterrupt() for inspector MainThreadInterface
This simplifies the code significantly, and removes the dependency of
the inspector code on the availability of a `MultiIsolatePlatform`
(by removing the dependency on a platform altogether).
It also fixes a memory leak that occurs when `RequestInterrupt()`
is used, but the interrupt handler is never called before the Isolate
is destroyed.
One downside is that this leads to a slight change in timing, because
inspector messages are not dispatched in a re-entrant way. This means
having to harden one test to account for that possibility by making
sure that the stack is always clear through a `setImmediate()`.
This does not affect the assertion made by the test, which is that
messages will not be delivered synchronously while other code is
executing.
https://github.com/nodejs/node/issues/32415
PR-URL: https://github.com/nodejs/node/pull/32523
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/inspector_agent.h')
-rw-r--r-- | src/inspector_agent.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/inspector_agent.h b/src/inspector_agent.h index 089077370db..efd090c49b4 100644 --- a/src/inspector_agent.h +++ b/src/inspector_agent.h @@ -116,6 +116,8 @@ class Agent { // Interface for interacting with inspectors in worker threads std::shared_ptr<WorkerManager> GetWorkerManager(); + inline Environment* env() const { return parent_env_; } + private: void ToggleAsyncHook(v8::Isolate* isolate, const v8::Global<v8::Function>& fn); |