Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: runtime/bin/eventhandler_android.cc

Issue 82873002: Limit the number of syscalls made by the Eventhandler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Mac fix. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/eventhandler_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « no previous file | runtime/bin/eventhandler_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698