OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_FUCHSIA) | 8 #if defined(TARGET_OS_FUCHSIA) |
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 void EventHandlerImplementation::HandleEvents(struct epoll_event* events, | 382 void EventHandlerImplementation::HandleEvents(struct epoll_event* events, |
383 int size) { | 383 int size) { |
384 bool interrupt_seen = false; | 384 bool interrupt_seen = false; |
385 for (int i = 0; i < size; i++) { | 385 for (int i = 0; i < size; i++) { |
386 if (events[i].data.ptr == NULL) { | 386 if (events[i].data.ptr == NULL) { |
387 interrupt_seen = true; | 387 interrupt_seen = true; |
388 } else { | 388 } else { |
389 DescriptorInfo* di = | 389 DescriptorInfo* di = |
390 reinterpret_cast<DescriptorInfo*>(events[i].data.ptr); | 390 reinterpret_cast<DescriptorInfo*>(events[i].data.ptr); |
391 const intptr_t old_mask = di->Mask(); | 391 const intptr_t old_mask = di->Mask(); |
392 intptr_t event_mask = GetPollEvents(events[i].events, di); | 392 const intptr_t event_mask = GetPollEvents(events[i].events, di); |
| 393 LOG_INFO("HandleEvents: fd=%ld events=%ld\n", di->fd(), event_mask); |
393 if ((event_mask & (1 << kErrorEvent)) != 0) { | 394 if ((event_mask & (1 << kErrorEvent)) != 0) { |
394 di->NotifyAllDartPorts(event_mask); | 395 di->NotifyAllDartPorts(event_mask); |
395 } | 396 UpdateEpollInstance(old_mask, di); |
396 event_mask &= ~(1 << kErrorEvent); | 397 } else if (event_mask != 0) { |
397 | |
398 LOG_INFO("HandleEvents: fd=%ld events=%ld\n", di->fd(), event_mask); | |
399 if (event_mask != 0) { | |
400 Dart_Port port = di->NextNotifyDartPort(event_mask); | 398 Dart_Port port = di->NextNotifyDartPort(event_mask); |
401 ASSERT(port != 0); | 399 ASSERT(port != 0); |
402 UpdateEpollInstance(old_mask, di); | 400 UpdateEpollInstance(old_mask, di); |
403 LOG_INFO("HandleEvents: Posting %ld to %ld for fd=%ld\n", event_mask, | 401 LOG_INFO("HandleEvents: Posting %ld to %ld for fd=%ld\n", event_mask, |
404 port, di->fd()); | 402 port, di->fd()); |
405 bool success = DartUtils::PostInt32(port, event_mask); | 403 bool success = DartUtils::PostInt32(port, event_mask); |
406 if (!success) { | 404 if (!success) { |
407 // This can happen if e.g. the isolate that owns the port has died | 405 // This can happen if e.g. the isolate that owns the port has died |
408 // for some reason. | 406 // for some reason. |
409 LOG_ERR("Failed to post event for fd %ld to port %ld", di->fd(), | 407 LOG_ERR("Failed to post event for fd %ld to port %ld", di->fd(), |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // The hashmap does not support keys with value 0. | 502 // The hashmap does not support keys with value 0. |
505 return dart::Utils::WordHash(fd + 1); | 503 return dart::Utils::WordHash(fd + 1); |
506 } | 504 } |
507 | 505 |
508 } // namespace bin | 506 } // namespace bin |
509 } // namespace dart | 507 } // namespace dart |
510 | 508 |
511 #endif // defined(TARGET_OS_FUCHSIA) | 509 #endif // defined(TARGET_OS_FUCHSIA) |
512 | 510 |
513 #endif // !defined(DART_IO_DISABLED) | 511 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |