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_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // If stdout, redirect fd to /dev/null. | 217 // If stdout, redirect fd to /dev/null. |
218 int null_fd = TEMP_FAILURE_RETRY(open("/dev/null", O_WRONLY)); | 218 int null_fd = TEMP_FAILURE_RETRY(open("/dev/null", O_WRONLY)); |
219 ASSERT(null_fd >= 0); | 219 ASSERT(null_fd >= 0); |
220 VOID_TEMP_FAILURE_RETRY(dup2(null_fd, STDOUT_FILENO)); | 220 VOID_TEMP_FAILURE_RETRY(dup2(null_fd, STDOUT_FILENO)); |
221 VOID_TEMP_FAILURE_RETRY(close(null_fd)); | 221 VOID_TEMP_FAILURE_RETRY(close(null_fd)); |
222 } else { | 222 } else { |
223 sd->Close(); | 223 sd->Close(); |
224 } | 224 } |
225 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); | 225 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); |
226 delete sd; | 226 delete sd; |
| 227 DartUtils::PostInt32(msg.dart_port, 1 << kDestroyedEvent); |
227 } else { | 228 } else { |
228 // Setup events to wait for. | 229 // Setup events to wait for. |
229 sd->SetPortAndMask(msg.dart_port, msg.data); | 230 sd->SetPortAndMask(msg.dart_port, msg.data); |
230 UpdateEpollInstance(epoll_fd_, sd); | 231 UpdateEpollInstance(epoll_fd_, sd); |
231 } | 232 } |
232 } | 233 } |
233 } | 234 } |
234 } | 235 } |
235 | 236 |
236 #ifdef DEBUG_POLL | 237 #ifdef DEBUG_POLL |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 435 |
435 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 436 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
436 // The hashmap does not support keys with value 0. | 437 // The hashmap does not support keys with value 0. |
437 return dart::Utils::WordHash(fd + 1); | 438 return dart::Utils::WordHash(fd + 1); |
438 } | 439 } |
439 | 440 |
440 } // namespace bin | 441 } // namespace bin |
441 } // namespace dart | 442 } // namespace dart |
442 | 443 |
443 #endif // defined(TARGET_OS_ANDROID) | 444 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |