Chromium Code Reviews| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 // Close the socket for writing. | 209 // Close the socket for writing. |
| 210 sd->ShutdownWrite(); | 210 sd->ShutdownWrite(); |
| 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 // If stdout, reuse fd and direct to /dev/null. | |
| 220 if (fd == fileno(stdout)) USE(fopen("/dev/null", "r")); | |
|
kustermann
2013/06/27 11:51:09
A few questions here:
- can we safely use fileno(
Anders Johnsen
2013/06/27 14:45:52
Done.
| |
| 219 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); | 221 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); |
| 220 delete sd; | 222 delete sd; |
| 221 } else { | 223 } else { |
| 222 // Setup events to wait for. | 224 // Setup events to wait for. |
| 223 sd->SetPortAndMask(msg.dart_port, msg.data); | 225 sd->SetPortAndMask(msg.dart_port, msg.data); |
| 224 UpdateEpollInstance(epoll_fd_, sd); | 226 UpdateEpollInstance(epoll_fd_, sd); |
| 225 } | 227 } |
| 226 } | 228 } |
| 227 } | 229 } |
| 228 } | 230 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 | 429 |
| 428 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 430 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 429 // The hashmap does not support keys with value 0. | 431 // The hashmap does not support keys with value 0. |
| 430 return dart::Utils::WordHash(fd + 1); | 432 return dart::Utils::WordHash(fd + 1); |
| 431 } | 433 } |
| 432 | 434 |
| 433 } // namespace bin | 435 } // namespace bin |
| 434 } // namespace dart | 436 } // namespace dart |
| 435 | 437 |
| 436 #endif // defined(TARGET_OS_ANDROID) | 438 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |