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

Unified Diff: runtime/bin/eventhandler_linux.cc

Issue 208653012: Only return eventhandler tokens in stacks of 8, to avoid runtime calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months 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
Index: runtime/bin/eventhandler_linux.cc
diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc
index d44486ecf5cdf853527d60f4b7433808ebf896a8..763db7774ae1c520d1b7a847fc38b67f0c8d9437 100644
--- a/runtime/bin/eventhandler_linux.cc
+++ b/runtime/bin/eventhandler_linux.cc
@@ -209,8 +209,11 @@ void EventHandlerImplementation::HandleInterruptFd() {
delete sd;
DartUtils::PostInt32(msg[i].dart_port, 1 << kDestroyedEvent);
} else if ((msg[i].data & (1 << kReturnTokenCommand)) != 0) {
- if (sd->ReturnToken()) {
- AddToEpollInstance(epoll_fd_, sd);
+ int count = msg[i].data & ((1 << kReturnTokenCommand) - 1);
+ for (int i = 0; i < count; i++) {
+ if (sd->ReturnToken()) {
+ AddToEpollInstance(epoll_fd_, sd);
+ }
}
} else {
// Setup events to wait for.
@@ -275,7 +278,7 @@ 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) {
- if (sd->TakeToken()) {
+ if (!sd->IsListeningSocket() && sd->TakeToken()) {
// Took last token, remove from epoll.
RemoveFromEpollInstance(epoll_fd_, sd);
}

Powered by Google App Engine
This is Rietveld 408576698