| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 7 | 7 |
| 8 #include "bin/eventhandler.h" | 8 #include "bin/eventhandler.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 sd->ShutdownWrite(); | 231 sd->ShutdownWrite(); |
| 232 UpdateKqueue(kqueue_fd_, sd); | 232 UpdateKqueue(kqueue_fd_, sd); |
| 233 } else if ((msg.data & (1 << kCloseCommand)) != 0) { | 233 } else if ((msg.data & (1 << kCloseCommand)) != 0) { |
| 234 ASSERT(msg.data == (1 << kCloseCommand)); | 234 ASSERT(msg.data == (1 << kCloseCommand)); |
| 235 // Close the socket and free system resources. | 235 // Close the socket and free system resources. |
| 236 RemoveFromKqueue(kqueue_fd_, sd); | 236 RemoveFromKqueue(kqueue_fd_, sd); |
| 237 intptr_t fd = sd->fd(); | 237 intptr_t fd = sd->fd(); |
| 238 sd->Close(); | 238 sd->Close(); |
| 239 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); | 239 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); |
| 240 delete sd; | 240 delete sd; |
| 241 DartUtils::PostInt32(msg.dart_port, 1 << kDestroyedEvent); |
| 241 } else { | 242 } else { |
| 242 if ((msg.data & (1 << kInEvent)) != 0 && sd->IsClosedRead()) { | 243 if ((msg.data & (1 << kInEvent)) != 0 && sd->IsClosedRead()) { |
| 243 DartUtils::PostInt32(msg.dart_port, 1 << kCloseEvent); | 244 DartUtils::PostInt32(msg.dart_port, 1 << kCloseEvent); |
| 244 } else { | 245 } else { |
| 245 // Setup events to wait for. | 246 // Setup events to wait for. |
| 246 sd->SetPortAndMask(msg.dart_port, msg.data); | 247 sd->SetPortAndMask(msg.dart_port, msg.data); |
| 247 UpdateKqueue(kqueue_fd_, sd); | 248 UpdateKqueue(kqueue_fd_, sd); |
| 248 } | 249 } |
| 249 } | 250 } |
| 250 } | 251 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 436 |
| 436 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 437 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 437 // The hashmap does not support keys with value 0. | 438 // The hashmap does not support keys with value 0. |
| 438 return dart::Utils::WordHash(fd + 1); | 439 return dart::Utils::WordHash(fd + 1); |
| 439 } | 440 } |
| 440 | 441 |
| 441 } // namespace bin | 442 } // namespace bin |
| 442 } // namespace dart | 443 } // namespace dart |
| 443 | 444 |
| 444 #endif // defined(TARGET_OS_MACOS) | 445 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |