Index: dart/runtime/bin/eventhandler_macos.cc |
diff --git a/dart/runtime/bin/eventhandler_macos.cc b/dart/runtime/bin/eventhandler_macos.cc |
index ede500f4028b0b64f88875ce0ad4c736ce260fc6..49ec2477e19b132b0033d078f664a68787d0c207 100644 |
--- a/dart/runtime/bin/eventhandler_macos.cc |
+++ b/dart/runtime/bin/eventhandler_macos.cc |
@@ -192,16 +192,13 @@ void EventHandlerImplementation::HandleInterruptFd() { |
shutdown_ = true; |
} else { |
SocketData* sd = GetSocketData(msg[i].id); |
- if ((msg[i].data & (1 << kShutdownReadCommand)) != 0) { |
- ASSERT(msg[i].data == (1 << kShutdownReadCommand)); |
+ if (IS_COMMAND(msg[i].data, kShutdownReadCommand)) { |
// Close the socket for reading. |
shutdown(sd->fd(), SHUT_RD); |
- } else if ((msg[i].data & (1 << kShutdownWriteCommand)) != 0) { |
- ASSERT(msg[i].data == (1 << kShutdownWriteCommand)); |
+ } else if (IS_COMMAND(msg[i].data, kShutdownWriteCommand)) { |
// Close the socket for writing. |
shutdown(sd->fd(), SHUT_WR); |
- } else if ((msg[i].data & (1 << kCloseCommand)) != 0) { |
- ASSERT(msg[i].data == (1 << kCloseCommand)); |
+ } else if (IS_COMMAND(msg[i].data, kCloseCommand)) { |
// Close the socket and free system resources. |
RemoveFromKqueue(kqueue_fd_, sd); |
intptr_t fd = sd->fd(); |
@@ -209,14 +206,15 @@ void EventHandlerImplementation::HandleInterruptFd() { |
socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); |
delete sd; |
DartUtils::PostInt32(msg[i].dart_port, 1 << kDestroyedEvent); |
- } else if ((msg[i].data & (1 << kReturnTokenCommand)) != 0) { |
- int count = msg[i].data & ((1 << kReturnTokenCommand) - 1); |
+ } else if (IS_COMMAND(msg[i].data, kReturnTokenCommand)) { |
+ int count = TOKEN_COUNT(msg[i].data); |
for (int i = 0; i < count; i++) { |
if (sd->ReturnToken()) { |
AddToKqueue(kqueue_fd_, sd); |
} |
} |
} else { |
+ ASSERT_NO_COMMAND(msg[i].data); |
// Setup events to wait for. |
ASSERT((msg[i].data > 0) && (msg[i].data < kIntptrMax)); |
ASSERT(sd->port() == 0); |