| 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(HOST_OS_FUCHSIA) | 8 #if defined(HOST_OS_FUCHSIA) |
| 9 | 9 |
| 10 #include "bin/eventhandler.h" | 10 #include "bin/eventhandler.h" |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 } else { | 430 } else { |
| 431 ASSERT(new_mask == 0); | 431 ASSERT(new_mask == 0); |
| 432 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); | 432 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); |
| 433 di->Close(); | 433 di->Close(); |
| 434 delete di; | 434 delete di; |
| 435 socket->SetClosedFd(); | 435 socket->SetClosedFd(); |
| 436 } | 436 } |
| 437 if (port != 0) { | 437 if (port != 0) { |
| 438 const bool success = DartUtils::PostInt32(port, 1 << kDestroyedEvent); | 438 const bool success = DartUtils::PostInt32(port, 1 << kDestroyedEvent); |
| 439 if (!success) { | 439 if (!success) { |
| 440 LOG_ERR("Failed to post destroy event to port %ld\n", port); | 440 LOG_INFO("Failed to post destroy event to port %ld\n", port); |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 } else if (IS_COMMAND(msg->data, kReturnTokenCommand)) { | 443 } else if (IS_COMMAND(msg->data, kReturnTokenCommand)) { |
| 444 const int count = TOKEN_COUNT(msg->data); | 444 const int count = TOKEN_COUNT(msg->data); |
| 445 const intptr_t old_mask = di->Mask(); | 445 const intptr_t old_mask = di->Mask(); |
| 446 LOG_INFO("\t Return Token: %ld: %lx\n", fd, old_mask); | 446 LOG_INFO("\t Return Token: %ld: %lx\n", fd, old_mask); |
| 447 di->ReturnTokens(msg->dart_port, count); | 447 di->ReturnTokens(msg->dart_port, count); |
| 448 UpdatePort(old_mask, di); | 448 UpdatePort(old_mask, di); |
| 449 } else if (IS_COMMAND(msg->data, kSetEventMaskCommand)) { | 449 } else if (IS_COMMAND(msg->data, kSetEventMaskCommand)) { |
| 450 // `events` can only have kInEvent/kOutEvent flags set. | 450 // `events` can only have kInEvent/kOutEvent flags set. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 di->NotifyAllDartPorts(event_mask); | 485 di->NotifyAllDartPorts(event_mask); |
| 486 } else if (event_mask != 0) { | 486 } else if (event_mask != 0) { |
| 487 event_mask = di->io_handle()->ToggleEvents(event_mask); | 487 event_mask = di->io_handle()->ToggleEvents(event_mask); |
| 488 if (event_mask != 0) { | 488 if (event_mask != 0) { |
| 489 Dart_Port port = di->NextNotifyDartPort(event_mask); | 489 Dart_Port port = di->NextNotifyDartPort(event_mask); |
| 490 ASSERT(port != 0); | 490 ASSERT(port != 0); |
| 491 bool success = DartUtils::PostInt32(port, event_mask); | 491 bool success = DartUtils::PostInt32(port, event_mask); |
| 492 if (!success) { | 492 if (!success) { |
| 493 // This can happen if e.g. the isolate that owns the port has died | 493 // This can happen if e.g. the isolate that owns the port has died |
| 494 // for some reason. | 494 // for some reason. |
| 495 LOG_ERR("Failed to post event to port %ld\n", port); | 495 LOG_INFO("Failed to post event to port %ld\n", port); |
| 496 } | 496 } |
| 497 } | 497 } |
| 498 } | 498 } |
| 499 UpdatePort(old_mask, di); | 499 UpdatePort(old_mask, di); |
| 500 } | 500 } |
| 501 | 501 |
| 502 | 502 |
| 503 int64_t EventHandlerImplementation::GetTimeout() const { | 503 int64_t EventHandlerImplementation::GetTimeout() const { |
| 504 if (!timeout_queue_.HasTimeout()) { | 504 if (!timeout_queue_.HasTimeout()) { |
| 505 return kInfinityTimeout; | 505 return kInfinityTimeout; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 // The hashmap does not support keys with value 0. | 582 // The hashmap does not support keys with value 0. |
| 583 return dart::Utils::WordHash(fd + 1); | 583 return dart::Utils::WordHash(fd + 1); |
| 584 } | 584 } |
| 585 | 585 |
| 586 } // namespace bin | 586 } // namespace bin |
| 587 } // namespace dart | 587 } // namespace dart |
| 588 | 588 |
| 589 #endif // defined(HOST_OS_FUCHSIA) | 589 #endif // defined(HOST_OS_FUCHSIA) |
| 590 | 590 |
| 591 #endif // !defined(DART_IO_DISABLED) | 591 #endif // !defined(DART_IO_DISABLED) |
| OLD | NEW |