| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 UpdateEpollInstance(epoll_fd_, sd); | 211 UpdateEpollInstance(epoll_fd_, sd); |
| 212 } else if ((msg.data & (1 << kCloseCommand)) != 0) { | 212 } else if ((msg.data & (1 << kCloseCommand)) != 0) { |
| 213 ASSERT(msg.data == (1 << kCloseCommand)); | 213 ASSERT(msg.data == (1 << kCloseCommand)); |
| 214 // Close the socket and free system resources and move on to | 214 // Close the socket and free system resources and move on to |
| 215 // next message. | 215 // next message. |
| 216 RemoveFromEpollInstance(epoll_fd_, sd); | 216 RemoveFromEpollInstance(epoll_fd_, sd); |
| 217 intptr_t fd = sd->fd(); | 217 intptr_t fd = sd->fd(); |
| 218 sd->Close(); | 218 sd->Close(); |
| 219 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); | 219 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); |
| 220 delete sd; | 220 delete sd; |
| 221 DartUtils::PostInt32(msg.dart_port, 1 << kDestroyedEvent); |
| 221 } else { | 222 } else { |
| 222 // Setup events to wait for. | 223 // Setup events to wait for. |
| 223 sd->SetPortAndMask(msg.dart_port, msg.data); | 224 sd->SetPortAndMask(msg.dart_port, msg.data); |
| 224 UpdateEpollInstance(epoll_fd_, sd); | 225 UpdateEpollInstance(epoll_fd_, sd); |
| 225 } | 226 } |
| 226 } | 227 } |
| 227 } | 228 } |
| 228 } | 229 } |
| 229 | 230 |
| 230 #ifdef DEBUG_POLL | 231 #ifdef DEBUG_POLL |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 426 |
| 426 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 427 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 427 // The hashmap does not support keys with value 0. | 428 // The hashmap does not support keys with value 0. |
| 428 return dart::Utils::WordHash(fd + 1); | 429 return dart::Utils::WordHash(fd + 1); |
| 429 } | 430 } |
| 430 | 431 |
| 431 } // namespace bin | 432 } // namespace bin |
| 432 } // namespace dart | 433 } // namespace dart |
| 433 | 434 |
| 434 #endif // defined(TARGET_OS_ANDROID) | 435 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |