| 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 #ifndef BIN_EVENTHANDLER_MACOS_H_ | 5 #ifndef BIN_EVENTHANDLER_MACOS_H_ |
| 6 #define BIN_EVENTHANDLER_MACOS_H_ | 6 #define BIN_EVENTHANDLER_MACOS_H_ |
| 7 | 7 |
| 8 #if !defined(BIN_EVENTHANDLER_H_) | 8 #if !defined(BIN_EVENTHANDLER_H_) |
| 9 #error Do not include eventhandler_macos.h directly; use eventhandler.h instead. | 9 #error Do not include eventhandler_macos.h directly; use eventhandler.h instead. |
| 10 #endif | 10 #endif |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 ~EventHandlerImplementation(); | 108 ~EventHandlerImplementation(); |
| 109 | 109 |
| 110 // Gets the socket data structure for a given file | 110 // Gets the socket data structure for a given file |
| 111 // descriptor. Creates a new one if one is not found. | 111 // descriptor. Creates a new one if one is not found. |
| 112 SocketData* GetSocketData(intptr_t fd); | 112 SocketData* GetSocketData(intptr_t fd); |
| 113 void SendData(intptr_t id, Dart_Port dart_port, int64_t data); | 113 void SendData(intptr_t id, Dart_Port dart_port, int64_t data); |
| 114 void Start(EventHandler* handler); | 114 void Start(EventHandler* handler); |
| 115 void Shutdown(); | 115 void Shutdown(); |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 intptr_t GetTimeout(); | 118 int64_t GetTimeout(); |
| 119 bool GetInterruptMessage(InterruptMessage* msg); | 119 bool GetInterruptMessage(InterruptMessage* msg); |
| 120 void HandleEvents(struct kevent* events, int size); | 120 void HandleEvents(struct kevent* events, int size); |
| 121 void HandleTimeout(); | 121 void HandleTimeout(); |
| 122 static void EventHandlerEntry(uword args); | 122 static void EventHandlerEntry(uword args); |
| 123 void WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data); | 123 void WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data); |
| 124 void HandleInterruptFd(); | 124 void HandleInterruptFd(); |
| 125 void SetPort(intptr_t fd, Dart_Port dart_port, intptr_t mask); | 125 void SetPort(intptr_t fd, Dart_Port dart_port, intptr_t mask); |
| 126 intptr_t GetEvents(struct kevent* event, SocketData* sd); | 126 intptr_t GetEvents(struct kevent* event, SocketData* sd); |
| 127 static void* GetHashmapKeyFromFd(intptr_t fd); | 127 static void* GetHashmapKeyFromFd(intptr_t fd); |
| 128 static uint32_t GetHashmapHashFromFd(intptr_t fd); | 128 static uint32_t GetHashmapHashFromFd(intptr_t fd); |
| 129 | 129 |
| 130 HashMap socket_map_; | 130 HashMap socket_map_; |
| 131 int64_t timeout_; // Time for next timeout. | 131 int64_t timeout_; // Time for next timeout. |
| 132 Dart_Port timeout_port_; | 132 Dart_Port timeout_port_; |
| 133 bool shutdown_; | 133 bool shutdown_; |
| 134 int interrupt_fds_[2]; | 134 int interrupt_fds_[2]; |
| 135 int kqueue_fd_; | 135 int kqueue_fd_; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace bin | 138 } // namespace bin |
| 139 } // namespace dart | 139 } // namespace dart |
| 140 | 140 |
| 141 #endif // BIN_EVENTHANDLER_MACOS_H_ | 141 #endif // BIN_EVENTHANDLER_MACOS_H_ |
| OLD | NEW |