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

Unified Diff: runtime/bin/eventhandler_macos.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_macos.h ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_macos.cc
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
index eb01d188d3d9d122da45feac0b701d3829d9f8ad..15b84f7a8617429de7fe5858a72747ec119c7220 100644
--- a/runtime/bin/eventhandler_macos.cc
+++ b/runtime/bin/eventhandler_macos.cc
@@ -206,8 +206,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()) {
- AddToKqueue(kqueue_fd_, sd);
+ int count = msg[i].data & ((1 << kReturnTokenCommand) - 1);
+ for (int i = 0; i < count; i++) {
+ if (sd->ReturnToken()) {
+ AddToKqueue(kqueue_fd_, sd);
+ }
}
} else {
// Setup events to wait for.
@@ -306,7 +309,7 @@ void EventHandlerImplementation::HandleEvents(struct kevent* events,
} else {
SocketData* sd = reinterpret_cast<SocketData*>(events[i].udata);
intptr_t event_mask = GetEvents(events + i, sd);
- if (event_mask != 0) {
+ if (!sd->IsListeningSocket() && event_mask != 0) {
if (sd->TakeToken()) {
// Took last token, remove from epoll.
RemoveFromKqueue(kqueue_fd_, sd);
« no previous file with comments | « runtime/bin/eventhandler_macos.h ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698