mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
chore: update libuv patch for event loop integration (#31647)
* chore: update libuv patch for loop integration * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
This commit is contained in:
@@ -322,6 +322,9 @@ NodeBindings::NodeBindings(BrowserEnvironment browser_env)
|
||||
} else {
|
||||
uv_loop_ = uv_default_loop();
|
||||
}
|
||||
|
||||
// Interrupt embed polling when a handle is started.
|
||||
uv_loop_configure(uv_loop_, UV_LOOP_INTERRUPT_ON_IO_CHANGE);
|
||||
}
|
||||
|
||||
NodeBindings::~NodeBindings() {
|
||||
|
||||
@@ -38,22 +38,9 @@ void NodeBindingsLinux::RunMessageLoop() {
|
||||
|
||||
handle_ = handle;
|
||||
|
||||
// Get notified when libuv's watcher queue changes.
|
||||
uv_loop_->data = this;
|
||||
uv_loop_->on_watcher_queue_updated = OnWatcherQueueChanged;
|
||||
|
||||
NodeBindings::RunMessageLoop();
|
||||
}
|
||||
|
||||
// static
|
||||
void NodeBindingsLinux::OnWatcherQueueChanged(uv_loop_t* loop) {
|
||||
NodeBindingsLinux* self = static_cast<NodeBindingsLinux*>(loop->data);
|
||||
|
||||
// We need to break the io polling in the epoll thread when loop's watcher
|
||||
// queue changes, otherwise new events cannot be notified.
|
||||
self->WakeupEmbedThread();
|
||||
}
|
||||
|
||||
void NodeBindingsLinux::PollEvents() {
|
||||
int timeout = uv_backend_timeout(uv_loop_);
|
||||
|
||||
|
||||
@@ -19,9 +19,6 @@ class NodeBindingsLinux : public NodeBindings {
|
||||
void RunMessageLoop() override;
|
||||
|
||||
private:
|
||||
// Called when uv's watcher queue changes.
|
||||
static void OnWatcherQueueChanged(uv_loop_t* loop);
|
||||
|
||||
void PollEvents() override;
|
||||
|
||||
// Epoll to poll for uv's backend fd.
|
||||
|
||||
@@ -38,22 +38,9 @@ void NodeBindingsMac::RunMessageLoop() {
|
||||
|
||||
handle_ = handle;
|
||||
|
||||
// Get notified when libuv's watcher queue changes.
|
||||
uv_loop_->data = this;
|
||||
uv_loop_->on_watcher_queue_updated = OnWatcherQueueChanged;
|
||||
|
||||
NodeBindings::RunMessageLoop();
|
||||
}
|
||||
|
||||
// static
|
||||
void NodeBindingsMac::OnWatcherQueueChanged(uv_loop_t* loop) {
|
||||
NodeBindingsMac* self = static_cast<NodeBindingsMac*>(loop->data);
|
||||
|
||||
// We need to break the io polling in the kqueue thread when loop's watcher
|
||||
// queue changes, otherwise new events cannot be notified.
|
||||
self->WakeupEmbedThread();
|
||||
}
|
||||
|
||||
void NodeBindingsMac::PollEvents() {
|
||||
struct timeval tv;
|
||||
int timeout = uv_backend_timeout(uv_loop_);
|
||||
|
||||
@@ -19,9 +19,6 @@ class NodeBindingsMac : public NodeBindings {
|
||||
void RunMessageLoop() override;
|
||||
|
||||
private:
|
||||
// Called when uv's watcher queue changes.
|
||||
static void OnWatcherQueueChanged(uv_loop_t* loop);
|
||||
|
||||
void PollEvents() override;
|
||||
|
||||
// uv's backend fd.
|
||||
|
||||
Reference in New Issue
Block a user