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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
6 | 6 |
7 #include "platform/globals.h" | 7 #include "platform/globals.h" |
8 #if defined(TARGET_OS_MACOS) | 8 #if defined(TARGET_OS_MACOS) |
9 | 9 |
10 #include "bin/eventhandler.h" | 10 #include "bin/eventhandler.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 const int kBufferSize = 1024; | 382 const int kBufferSize = 1024; |
383 char error_message[kBufferSize]; | 383 char error_message[kBufferSize]; |
384 Utils::StrError(events[i].data, error_message, kBufferSize); | 384 Utils::StrError(events[i].data, error_message, kBufferSize); |
385 FATAL1("kevent failed %s\n", error_message); | 385 FATAL1("kevent failed %s\n", error_message); |
386 } | 386 } |
387 if (events[i].udata == NULL) { | 387 if (events[i].udata == NULL) { |
388 interrupt_seen = true; | 388 interrupt_seen = true; |
389 } else { | 389 } else { |
390 DescriptorInfo* di = reinterpret_cast<DescriptorInfo*>(events[i].udata); | 390 DescriptorInfo* di = reinterpret_cast<DescriptorInfo*>(events[i].udata); |
391 const intptr_t old_mask = di->Mask(); | 391 const intptr_t old_mask = di->Mask(); |
392 intptr_t event_mask = GetEvents(events + i, di); | 392 const intptr_t event_mask = GetEvents(events + i, di); |
393 if ((event_mask & (1 << kErrorEvent)) != 0) { | 393 if ((event_mask & (1 << kErrorEvent)) != 0) { |
394 di->NotifyAllDartPorts(event_mask); | 394 di->NotifyAllDartPorts(event_mask); |
395 } | 395 UpdateKQueueInstance(old_mask, di); |
396 event_mask &= ~(1 << kErrorEvent); | 396 } else if (event_mask != 0) { |
397 | |
398 if (event_mask != 0) { | |
399 Dart_Port port = di->NextNotifyDartPort(event_mask); | 397 Dart_Port port = di->NextNotifyDartPort(event_mask); |
400 ASSERT(port != 0); | 398 ASSERT(port != 0); |
401 UpdateKQueueInstance(old_mask, di); | 399 UpdateKQueueInstance(old_mask, di); |
402 DartUtils::PostInt32(port, event_mask); | 400 DartUtils::PostInt32(port, event_mask); |
403 } | 401 } |
404 } | 402 } |
405 } | 403 } |
406 if (interrupt_seen) { | 404 if (interrupt_seen) { |
407 // Handle after socket events, so we avoid closing a socket before we handle | 405 // Handle after socket events, so we avoid closing a socket before we handle |
408 // the current events. | 406 // the current events. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 // The hashmap does not support keys with value 0. | 504 // The hashmap does not support keys with value 0. |
507 return dart::Utils::WordHash(fd + 1); | 505 return dart::Utils::WordHash(fd + 1); |
508 } | 506 } |
509 | 507 |
510 } // namespace bin | 508 } // namespace bin |
511 } // namespace dart | 509 } // namespace dart |
512 | 510 |
513 #endif // defined(TARGET_OS_MACOS) | 511 #endif // defined(TARGET_OS_MACOS) |
514 | 512 |
515 #endif // !defined(DART_IO_DISABLED) | 513 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |