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

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: Review fixes. 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
« no previous file with comments | « runtime/bin/eventhandler_linux.h ('k') | runtime/bin/eventhandler_macos.h » ('j') | 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 3d1f518003cab730d8f4432cb5d56b79a0ebf4f9..020cfc98054b421d8121fecd9b493e67041f6a47 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.
@@ -276,7 +279,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);
}
« no previous file with comments | « runtime/bin/eventhandler_linux.h ('k') | runtime/bin/eventhandler_macos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698