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

Unified Diff: runtime/bin/eventhandler_android.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_android.h ('k') | runtime/bin/eventhandler_linux.h » ('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 998481f61145335cabee04efafa44c02e249b129..d70f2d87239a71e83afdf63f3a080b1b8aa791e2 100644
--- a/runtime/bin/eventhandler_android.cc
+++ b/runtime/bin/eventhandler_android.cc
@@ -190,8 +190,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.
@@ -249,7 +252,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_android.h ('k') | runtime/bin/eventhandler_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698