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

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

Issue 665823007: Several bugfixes in dart:io's handing of sockets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added suppression ServerSocketReference regression test for nonlinux OSes Created 6 years, 2 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
Index: dart/runtime/bin/eventhandler_android.cc
diff --git a/dart/runtime/bin/eventhandler_android.cc b/dart/runtime/bin/eventhandler_android.cc
index b1a4b667cb765960ff24a08b02178348ad6a7866..680bcae7b99bf6cf8125ca688efb1f63b772c78c 100644
--- a/dart/runtime/bin/eventhandler_android.cc
+++ b/dart/runtime/bin/eventhandler_android.cc
@@ -174,16 +174,14 @@ 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 and move on to
// next message.
RemoveFromEpollInstance(epoll_fd_, sd);
@@ -192,14 +190,16 @@ 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()) {
AddToEpollInstance(epoll_fd_, sd);
}
}
} else {
+ ASSERT_NO_COMMAND(msg[i].data);
// Setup events to wait for.
sd->SetPortAndMask(msg[i].dart_port, msg[i].data);
AddToEpollInstance(epoll_fd_, sd);

Powered by Google App Engine
This is Rietveld 408576698