| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 const int kBufferSize = 1024; | 302 const int kBufferSize = 1024; |
| 303 char error_message[kBufferSize]; | 303 char error_message[kBufferSize]; |
| 304 strerror_r(events[i].data, error_message, kBufferSize); | 304 strerror_r(events[i].data, error_message, kBufferSize); |
| 305 FATAL1("kevent failed %s\n", error_message); | 305 FATAL1("kevent failed %s\n", error_message); |
| 306 } | 306 } |
| 307 if (events[i].udata == NULL) { | 307 if (events[i].udata == NULL) { |
| 308 interrupt_seen = true; | 308 interrupt_seen = true; |
| 309 } else { | 309 } else { |
| 310 SocketData* sd = reinterpret_cast<SocketData*>(events[i].udata); | 310 SocketData* sd = reinterpret_cast<SocketData*>(events[i].udata); |
| 311 intptr_t event_mask = GetEvents(events + i, sd); | 311 intptr_t event_mask = GetEvents(events + i, sd); |
| 312 if (!sd->IsListeningSocket() && event_mask != 0) { | 312 if (event_mask != 0) { |
| 313 if (sd->TakeToken()) { | 313 if (!sd->IsListeningSocket() && sd->TakeToken()) { |
| 314 // Took last token, remove from epoll. | 314 // Took last token, remove from epoll. |
| 315 RemoveFromKqueue(kqueue_fd_, sd); | 315 RemoveFromKqueue(kqueue_fd_, sd); |
| 316 } | 316 } |
| 317 Dart_Port port = sd->port(); | 317 Dart_Port port = sd->port(); |
| 318 ASSERT(port != 0); | 318 ASSERT(port != 0); |
| 319 DartUtils::PostInt32(port, event_mask); | 319 DartUtils::PostInt32(port, event_mask); |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 if (interrupt_seen) { | 323 if (interrupt_seen) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 418 |
| 419 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 419 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 420 // The hashmap does not support keys with value 0. | 420 // The hashmap does not support keys with value 0. |
| 421 return dart::Utils::WordHash(fd + 1); | 421 return dart::Utils::WordHash(fd + 1); |
| 422 } | 422 } |
| 423 | 423 |
| 424 } // namespace bin | 424 } // namespace bin |
| 425 } // namespace dart | 425 } // namespace dart |
| 426 | 426 |
| 427 #endif // defined(TARGET_OS_MACOS) | 427 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |