Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2e4536e

Browse filesBrowse files
committed
src: use env->RequestInterrupt() for inspector io thread start
This cleans up `Agent::RequestIoThreadStart()` significantly. Backport-PR-URL: #35241 PR-URL: #32523 Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 4704e58 commit 2e4536e
Copy full SHA for 2e4536e

File tree

Expand file treeCollapse file tree

1 file changed

+4
-23
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-23
lines changed
Open diff view settings
Collapse file

‎src/inspector_agent.cc‎

Copy file name to clipboardExpand all lines: src/inspector_agent.cc
+4-23Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ using v8::Local;
4646
using v8::Message;
4747
using v8::Object;
4848
using v8::Task;
49-
using v8::TaskRunner;
5049
using v8::Value;
5150
using v8_inspector::StringBuffer;
5251
using v8_inspector::StringView;
@@ -61,18 +60,6 @@ static std::atomic_bool start_io_thread_async_initialized { false };
6160
// Protects the Agent* stored in start_io_thread_async.data.
6261
static Mutex start_io_thread_async_mutex;
6362

64-
class StartIoTask : public Task {
65-
public:
66-
explicit StartIoTask(Agent* agent) : agent(agent) {}
67-
68-
void Run() override {
69-
agent->StartIoThread();
70-
}
71-
72-
private:
73-
Agent* agent;
74-
};
75-
7663
std::unique_ptr<StringBuffer> ToProtocolString(Isolate* isolate,
7764
Local<Value> value) {
7865
TwoByteValue buffer(isolate, value);
@@ -84,10 +71,6 @@ void StartIoThreadAsyncCallback(uv_async_t* handle) {
8471
static_cast<Agent*>(handle->data)->StartIoThread();
8572
}
8673

87-
void StartIoInterrupt(Isolate* isolate, void* agent) {
88-
static_cast<Agent*>(agent)->StartIoThread();
89-
}
90-
9174

9275
#ifdef __POSIX__
9376
static void StartIoThreadWakeup(int signo) {
@@ -981,12 +964,10 @@ void Agent::RequestIoThreadStart() {
981964
// for IO events)
982965
CHECK(start_io_thread_async_initialized);
983966
uv_async_send(&start_io_thread_async);
984-
Isolate* isolate = parent_env_->isolate();
985-
v8::Platform* platform = parent_env_->isolate_data()->platform();
986-
std::shared_ptr<TaskRunner> taskrunner =
987-
platform->GetForegroundTaskRunner(isolate);
988-
taskrunner->PostTask(std::make_unique<StartIoTask>(this));
989-
isolate->RequestInterrupt(StartIoInterrupt, this);
967+
parent_env_->RequestInterrupt([this](Environment*) {
968+
StartIoThread();
969+
});
970+
990971
CHECK(start_io_thread_async_initialized);
991972
uv_async_send(&start_io_thread_async);
992973
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.