Chromium Code Reviews| Index: runtime/bin/eventhandler_android.cc |
| diff --git a/runtime/bin/eventhandler_android.cc b/runtime/bin/eventhandler_android.cc |
| index 42ff0b094a6fe3a274b9a5592b9865e710c75665..8040e1ef4e2d24d391619eb98ff6c8071eeb3499 100644 |
| --- a/runtime/bin/eventhandler_android.cc |
| +++ b/runtime/bin/eventhandler_android.cc |
| @@ -74,6 +74,9 @@ static void UpdateEpollInstance(intptr_t epoll_fd_, SocketData* sd) { |
| event.events = sd->GetPollEvents(); |
| event.data.ptr = sd; |
| if (sd->port() != 0 && event.events != 0) { |
| + // Only report events once and wait for them to be re-enabled after the |
| + // event has been handled by the Dart code. |
| + event.events |= EPOLLONESHOT; |
|
zra
2013/11/22 22:30:58
Is this used only in the standalone VM? It isn't b
|
| int status = 0; |
| if (sd->tracked_by_epoll()) { |
| status = TEMP_FAILURE_RETRY(epoll_ctl(epoll_fd_, |
| @@ -342,10 +345,6 @@ void EventHandlerImplementation::HandleEvents(struct epoll_event* events, |
| SocketData* sd = reinterpret_cast<SocketData*>(events[i].data.ptr); |
| intptr_t event_mask = GetPollEvents(events[i].events, sd); |
| if (event_mask != 0) { |
| - // Unregister events for the file descriptor. Events will be |
| - // registered again when the current event has been handled in |
| - // Dart code. |
| - RemoveFromEpollInstance(epoll_fd_, sd); |
| Dart_Port port = sd->port(); |
| ASSERT(port != 0); |
| DartUtils::PostInt32(port, event_mask); |
| @@ -401,8 +400,9 @@ void EventHandlerImplementation::Poll(uword args) { |
| if (errno != EWOULDBLOCK) { |
| perror("Poll failed"); |
| } |
| - } else { |
| + } else if (result == 0) { |
| handler->HandleTimeout(); |
| + } else { |
| handler->HandleEvents(events, result); |
| } |
| } |