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>2020-03-22 21:03:24 +0300
committerAnna Henningsen <anna@addaleax.net>2020-04-10 18:47:12 +0300
commit32e3a6bb87f2f88b8f54ff9e9f216aa5f5f0a647 (patch)
treec903f87d77e3fef5797acda63b4cc0844a6c0473 /src/inspector_agent.cc
parent583edd9526b3b9a6965761c7cf53495957f082ef (diff)
src: use env->RequestInterrupt() for inspector io thread start
This cleans up `Agent::RequestIoThreadStart()` significantly. 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.cc')
-rw-r--r--src/inspector_agent.cc27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index 2852a0aefbe..8e598c7d1cc 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -47,7 +47,6 @@ using v8::Message;
using v8::Object;
using v8::String;
using v8::Task;
-using v8::TaskRunner;
using v8::Value;
using v8_inspector::StringBuffer;
@@ -63,18 +62,6 @@ static std::atomic_bool start_io_thread_async_initialized { false };
// Protects the Agent* stored in start_io_thread_async.data.
static Mutex start_io_thread_async_mutex;
-class StartIoTask : public Task {
- public:
- explicit StartIoTask(Agent* agent) : agent(agent) {}
-
- void Run() override {
- agent->StartIoThread();
- }
-
- private:
- Agent* agent;
-};
-
std::unique_ptr<StringBuffer> ToProtocolString(Isolate* isolate,
Local<Value> value) {
TwoByteValue buffer(isolate, value);
@@ -86,10 +73,6 @@ void StartIoThreadAsyncCallback(uv_async_t* handle) {
static_cast<Agent*>(handle->data)->StartIoThread();
}
-void StartIoInterrupt(Isolate* isolate, void* agent) {
- static_cast<Agent*>(agent)->StartIoThread();
-}
-
#ifdef __POSIX__
static void StartIoThreadWakeup(int signo, siginfo_t* info, void* ucontext) {
@@ -978,12 +961,10 @@ void Agent::RequestIoThreadStart() {
// for IO events)
CHECK(start_io_thread_async_initialized);
uv_async_send(&start_io_thread_async);
- Isolate* isolate = parent_env_->isolate();
- v8::Platform* platform = parent_env_->isolate_data()->platform();
- std::shared_ptr<TaskRunner> taskrunner =
- platform->GetForegroundTaskRunner(isolate);
- taskrunner->PostTask(std::make_unique<StartIoTask>(this));
- isolate->RequestInterrupt(StartIoInterrupt, this);
+ parent_env_->RequestInterrupt([this](Environment*) {
+ StartIoThread();
+ });
+
CHECK(start_io_thread_async_initialized);
uv_async_send(&start_io_thread_async);
}