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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 if ((events[i].flags & EV_ERROR) != 0) { | 381 if ((events[i].flags & EV_ERROR) != 0) { |
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 intptr_t event_mask = GetEvents(events + i, di); | 392 intptr_t event_mask = GetEvents(events + i, di); |
392 if ((event_mask & (1 << kErrorEvent)) != 0) { | 393 if ((event_mask & (1 << kErrorEvent)) != 0) { |
393 di->NotifyAllDartPorts(event_mask); | 394 di->NotifyAllDartPorts(event_mask); |
394 } | 395 } |
395 event_mask &= ~(1 << kErrorEvent); | 396 event_mask &= ~(1 << kErrorEvent); |
396 | 397 |
397 if (event_mask != 0) { | 398 if (event_mask != 0) { |
398 intptr_t old_mask = di->Mask(); | |
399 Dart_Port port = di->NextNotifyDartPort(event_mask); | 399 Dart_Port port = di->NextNotifyDartPort(event_mask); |
400 ASSERT(port != 0); | 400 ASSERT(port != 0); |
401 UpdateKQueueInstance(old_mask, di); | 401 UpdateKQueueInstance(old_mask, di); |
402 DartUtils::PostInt32(port, event_mask); | 402 DartUtils::PostInt32(port, event_mask); |
403 } | 403 } |
404 } | 404 } |
405 } | 405 } |
406 if (interrupt_seen) { | 406 if (interrupt_seen) { |
407 // Handle after socket events, so we avoid closing a socket before we handle | 407 // Handle after socket events, so we avoid closing a socket before we handle |
408 // the current events. | 408 // 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. | 506 // The hashmap does not support keys with value 0. |
507 return dart::Utils::WordHash(fd + 1); | 507 return dart::Utils::WordHash(fd + 1); |
508 } | 508 } |
509 | 509 |
510 } // namespace bin | 510 } // namespace bin |
511 } // namespace dart | 511 } // namespace dart |
512 | 512 |
513 #endif // defined(TARGET_OS_MACOS) | 513 #endif // defined(TARGET_OS_MACOS) |
514 | 514 |
515 #endif // !defined(DART_IO_DISABLED) | 515 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |