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

Unified Diff: dart/runtime/bin/eventhandler_linux.cc

Issue 900363004: Introduce a kSetEventMaskCommand, some cleanups in windows eventhandler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 5 years, 10 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 | « dart/runtime/bin/eventhandler_android.cc ('k') | dart/runtime/bin/eventhandler_macos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/runtime/bin/eventhandler_linux.cc
diff --git a/dart/runtime/bin/eventhandler_linux.cc b/dart/runtime/bin/eventhandler_linux.cc
index 7f81e3aa80e09e49cf60c6e6d5e623f6acdc0c45..475b39dd378ab307aba9c356315cb9e328f13439 100644
--- a/dart/runtime/bin/eventhandler_linux.cc
+++ b/dart/runtime/bin/eventhandler_linux.cc
@@ -193,8 +193,10 @@ void EventHandlerImplementation::HandleInterruptFd() {
} else if (msg[i].id == kShutdownId) {
shutdown_ = true;
} else {
+ ASSERT((msg[i].data & COMMAND_MASK) != 0);
+
SocketData* sd = GetSocketData(
- msg[i].id, (msg[i].data & (1 << kListeningSocket)) != 0);
+ msg[i].id, IS_LISTENING_SOCKET(msg[i].data));
if (IS_COMMAND(msg[i].data, kShutdownReadCommand)) {
ASSERT(!sd->IsListeningSocket());
// Close the socket for reading.
@@ -219,13 +221,18 @@ void EventHandlerImplementation::HandleInterruptFd() {
if (sd->ReturnToken(msg[i].dart_port, count)) {
AddToEpollInstance(epoll_fd_, sd);
}
- } else {
- ASSERT_NO_COMMAND(msg[i].data);
+ } else if (IS_COMMAND(msg[i].data, kSetEventMaskCommand)) {
+ // `events` can only have kInEvent/kOutEvent flags set.
+ intptr_t events = msg[i].data & EVENT_MASK;
+ ASSERT(0 == (events & ~(1 << kInEvent | 1 << kOutEvent)));
+
// Setup events to wait for.
if (sd->AddPort(msg[i].dart_port)) {
- sd->SetMask(msg[i].data);
+ sd->SetMask(events);
AddToEpollInstance(epoll_fd_, sd);
}
+ } else {
+ UNREACHABLE();
}
}
}
« no previous file with comments | « dart/runtime/bin/eventhandler_android.cc ('k') | dart/runtime/bin/eventhandler_macos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698