Bug 1111079 - Backport some IPC message/channel fixes. r=bent a=me

This commit is contained in:
Jed Davis 2015-03-19 16:07:37 -07:00
Родитель 94fe221522
Коммит fedf6a1c91
2 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -175,6 +175,23 @@ bool MessagePumpLibevent::WatchFileDescriptor(int fd,
should_delete_event = false;
// Ownership is transferred to the controller.
evt = mozilla::MakeUnique<event>();
} else {
// It's illegal to use this function to listen on 2 separate fds with the
// same |controller|.
if (EVENT_FD(evt.get()) != fd) {
NOTREACHED() << "FDs don't match" << EVENT_FD(evt.get()) << "!=" << fd;
return false;
}
// Make sure we don't pick up any funky internal libevent masks.
int old_interest_mask = evt.get()->ev_events &
(EV_READ | EV_WRITE | EV_PERSIST);
// Combine old/new event masks.
event_mask |= old_interest_mask;
// Must disarm the event before we can reuse it.
event_del(evt.get());
}
// Set current interest mask and message pump for this event.

Просмотреть файл

@ -844,6 +844,8 @@ void Channel::ChannelImpl::OnFileCanReadWithoutBlocking(int fd) {
if (!ProcessIncomingMessages()) {
Close();
listener_->OnChannelError();
// The OnChannelError() call may delete this, so we need to exit now.
return;
}
}