| Index: runtime/bin/eventhandler_macos.h
|
| diff --git a/runtime/bin/eventhandler_macos.h b/runtime/bin/eventhandler_macos.h
|
| index babb32570941ae3676fc88200cc8bd55221951bc..85e5ad5904ca7c2031c19b699ada575bd8b119fd 100644
|
| --- a/runtime/bin/eventhandler_macos.h
|
| +++ b/runtime/bin/eventhandler_macos.h
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| @@ -8,6 +8,7 @@
|
| #include <unistd.h>
|
| #include <sys/socket.h>
|
|
|
| +#include "bin/hashmap.h"
|
|
|
| class InterruptMessage {
|
| public:
|
| @@ -25,6 +26,10 @@ enum PortDataFlags {
|
|
|
| class SocketData {
|
| public:
|
| + explicit SocketData(intptr_t fd) : fd_(fd), port_(0), mask_(0), flags_(0) {
|
| + ASSERT(fd_ != -1);
|
| + }
|
| +
|
| intptr_t GetPollEvents();
|
|
|
| void Unregister() {
|
| @@ -46,7 +51,7 @@ class SocketData {
|
| Unregister();
|
| flags_ = 0;
|
| close(fd_);
|
| - fd_ = 0;
|
| + fd_ = -1;
|
| }
|
|
|
| bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; }
|
| @@ -60,12 +65,12 @@ class SocketData {
|
| bool HasPollEvents() { return mask_ != 0; }
|
|
|
| void SetPortAndMask(Dart_Port port, intptr_t mask) {
|
| + ASSERT(fd_ != -1);
|
| port_ = port;
|
| mask_ = mask;
|
| }
|
|
|
| intptr_t fd() { return fd_; }
|
| - void set_fd(intptr_t fd) { fd_ = fd; }
|
| Dart_Port port() { return port_; }
|
| intptr_t mask() { return mask_; }
|
|
|
| @@ -97,9 +102,10 @@ class EventHandlerImplementation {
|
| void HandleInterruptFd();
|
| void SetPort(intptr_t fd, Dart_Port dart_port, intptr_t mask);
|
| intptr_t GetPollEvents(struct pollfd* pollfd);
|
| + static void* GetHashmapKeyFromFd(intptr_t fd);
|
| + static uint32_t GetHashmapHashFromFd(intptr_t fd);
|
|
|
| - SocketData* socket_map_;
|
| - intptr_t socket_map_size_;
|
| + HashMap socket_map_;
|
| int64_t timeout_; // Time for next timeout.
|
| Dart_Port timeout_port_;
|
| int interrupt_fds_[2];
|
|
|