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

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

Issue 14864009: Keep track of when a socket has been destroyed (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove delete_handle marker. 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
« no previous file with comments | « runtime/bin/eventhandler_linux.cc ('k') | runtime/bin/eventhandler_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MACOS) 6 #if defined(TARGET_OS_MACOS)
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // If stdout, redirect fd to /dev/null. 237 // If stdout, redirect fd to /dev/null.
238 int null_fd = TEMP_FAILURE_RETRY(open("/dev/null", O_WRONLY)); 238 int null_fd = TEMP_FAILURE_RETRY(open("/dev/null", O_WRONLY));
239 ASSERT(null_fd >= 0); 239 ASSERT(null_fd >= 0);
240 VOID_TEMP_FAILURE_RETRY(dup2(null_fd, STDOUT_FILENO)); 240 VOID_TEMP_FAILURE_RETRY(dup2(null_fd, STDOUT_FILENO));
241 VOID_TEMP_FAILURE_RETRY(close(null_fd)); 241 VOID_TEMP_FAILURE_RETRY(close(null_fd));
242 } else { 242 } else {
243 sd->Close(); 243 sd->Close();
244 } 244 }
245 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); 245 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd));
246 delete sd; 246 delete sd;
247 DartUtils::PostInt32(msg.dart_port, 1 << kDestroyedEvent);
247 } else { 248 } else {
248 if ((msg.data & (1 << kInEvent)) != 0 && sd->IsClosedRead()) { 249 if ((msg.data & (1 << kInEvent)) != 0 && sd->IsClosedRead()) {
249 DartUtils::PostInt32(msg.dart_port, 1 << kCloseEvent); 250 DartUtils::PostInt32(msg.dart_port, 1 << kCloseEvent);
250 } else { 251 } else {
251 // Setup events to wait for. 252 // Setup events to wait for.
252 sd->SetPortAndMask(msg.dart_port, msg.data); 253 sd->SetPortAndMask(msg.dart_port, msg.data);
253 UpdateKqueue(kqueue_fd_, sd); 254 UpdateKqueue(kqueue_fd_, sd);
254 } 255 }
255 } 256 }
256 } 257 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 445
445 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { 446 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
446 // The hashmap does not support keys with value 0. 447 // The hashmap does not support keys with value 0.
447 return dart::Utils::WordHash(fd + 1); 448 return dart::Utils::WordHash(fd + 1);
448 } 449 }
449 450
450 } // namespace bin 451 } // namespace bin
451 } // namespace dart 452 } // namespace dart
452 453
453 #endif // defined(TARGET_OS_MACOS) 454 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_linux.cc ('k') | runtime/bin/eventhandler_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698