Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: runtime/bin/eventhandler_android.cc

Issue 18031003: Stop printing when stdout is closed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up test. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/eventhandler_linux.cc » ('j') | tests/standalone/io/stdout_close_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698