mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibCore: Simplify Core::Notifier by only allowing one event type
Not a single client of this API actually used the event mask feature to listen for readability AND writability. Let's simplify the API and have only one hook: on_activation.
This commit is contained in:
parent
1587caef84
commit
411d36719e
Notes:
sideshowbarker
2024-07-17 07:06:47 +09:00
Author: https://github.com/awesomekling
Commit: 411d36719e
Pull-request: https://github.com/SerenityOS/serenity/pull/18493
Reviewed-by: https://github.com/FireFox317
24 changed files with 80 additions and 99 deletions
|
@ -651,11 +651,11 @@ retry:
|
|||
max_fd = max(max_fd, max_fd_added);
|
||||
|
||||
for (auto& notifier : *s_notifiers) {
|
||||
if (notifier->event_mask() & Notifier::Read)
|
||||
if (notifier->type() == Notifier::Type::Read)
|
||||
add_fd_to_set(notifier->fd(), rfds);
|
||||
if (notifier->event_mask() & Notifier::Write)
|
||||
if (notifier->type() == Notifier::Type::Write)
|
||||
add_fd_to_set(notifier->fd(), wfds);
|
||||
if (notifier->event_mask() & Notifier::Exceptional)
|
||||
if (notifier->type() == Notifier::Type::Exceptional)
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@ -757,13 +757,11 @@ try_select_again:
|
|||
|
||||
// Handle file system notifiers by making them normal events.
|
||||
for (auto& notifier : *s_notifiers) {
|
||||
if (FD_ISSET(notifier->fd(), &rfds)) {
|
||||
if (notifier->event_mask() & Notifier::Event::Read)
|
||||
post_event(*notifier, make<NotifierReadEvent>(notifier->fd()));
|
||||
if (notifier->type() == Notifier::Type::Read && FD_ISSET(notifier->fd(), &rfds)) {
|
||||
post_event(*notifier, make<NotifierActivationEvent>(notifier->fd()));
|
||||
}
|
||||
if (FD_ISSET(notifier->fd(), &wfds)) {
|
||||
if (notifier->event_mask() & Notifier::Event::Write)
|
||||
post_event(*notifier, make<NotifierWriteEvent>(notifier->fd()));
|
||||
if (notifier->type() == Notifier::Type::Write && FD_ISSET(notifier->fd(), &wfds)) {
|
||||
post_event(*notifier, make<NotifierActivationEvent>(notifier->fd()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue