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

Unified Diff: dart/runtime/bin/eventhandler_macos.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 two spaces as requested 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
« no previous file with comments | « dart/runtime/bin/eventhandler_linux.cc ('k') | dart/runtime/bin/socket_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « dart/runtime/bin/eventhandler_linux.cc ('k') | dart/runtime/bin/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698