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

Unified Diff: runtime/bin/eventhandler_linux.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: 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_linux.cc
diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc
index 11e11d3d6f28d74511a65ccb5ad5b1b3bec11a42..6fdd2d328a72c846b8460a603f720f9b8afec81a 100644
--- a/runtime/bin/eventhandler_linux.cc
+++ b/runtime/bin/eventhandler_linux.cc
@@ -74,6 +74,7 @@ static void UpdateEpollInstance(intptr_t epoll_fd_, SocketData* sd) {
event.events = sd->GetPollEvents();
event.data.ptr = sd;
if (sd->port() != 0 && event.events != 0) {
Søren Gjesse 2013/11/22 07:38:56 Please add a comment here. "Only report events onc
Anders Johnsen 2013/11/22 07:48:34 Done.
+ event.events |= EPOLLONESHOT;
Søren Gjesse 2013/11/22 07:38:56 Please open a bug on checking whether this is poss
Anders Johnsen 2013/11/22 07:48:34 Added mac and android versions too.
int status = 0;
if (sd->tracked_by_epoll()) {
status = TEMP_FAILURE_RETRY(epoll_ctl(epoll_fd_,
@@ -342,10 +343,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);
@@ -402,8 +399,9 @@ void EventHandlerImplementation::Poll(uword args) {
if (errno != EWOULDBLOCK) {
perror("Poll failed");
}
- } else {
+ } else if (result == 0) {
handler_impl->HandleTimeout();
+ } else {
handler_impl->HandleEvents(events, result);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698