| 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_LINUX_H_ | 5 #ifndef BIN_EVENTHANDLER_LINUX_H_ |
| 6 #define BIN_EVENTHANDLER_LINUX_H_ | 6 #define BIN_EVENTHANDLER_LINUX_H_ |
| 7 | 7 |
| 8 #if !defined(BIN_EVENTHANDLER_H_) | 8 #if !defined(BIN_EVENTHANDLER_H_) |
| 9 #error Do not include eventhandler_linux.h directly; use eventhandler.h instead. | 9 #error Do not include eventhandler_linux.h directly; use eventhandler.h instead. |
| 10 #endif | 10 #endif |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 | 86 |
| 87 class EventHandlerImplementation { | 87 class EventHandlerImplementation { |
| 88 public: | 88 public: |
| 89 EventHandlerImplementation(); | 89 EventHandlerImplementation(); |
| 90 ~EventHandlerImplementation(); | 90 ~EventHandlerImplementation(); |
| 91 | 91 |
| 92 // Gets the socket data structure for a given file | 92 // Gets the socket data structure for a given file |
| 93 // descriptor. Creates a new one if one is not found. | 93 // descriptor. Creates a new one if one is not found. |
| 94 SocketData* GetSocketData(intptr_t fd); | 94 SocketData* GetSocketData(intptr_t fd); |
| 95 void SendData(intptr_t id, Dart_Port dart_port, intptr_t data); | 95 void SendData(intptr_t id, Dart_Port dart_port, int64_t data); |
| 96 void Start(); | 96 void Start(); |
| 97 void Shutdown(); | 97 void Shutdown(); |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 intptr_t GetTimeout(); | 100 intptr_t GetTimeout(); |
| 101 bool GetInterruptMessage(InterruptMessage* msg); | 101 bool GetInterruptMessage(InterruptMessage* msg); |
| 102 void HandleEvents(struct epoll_event* events, int size); | 102 void HandleEvents(struct epoll_event* events, int size); |
| 103 void HandleTimeout(); | 103 void HandleTimeout(); |
| 104 static void Poll(uword args); | 104 static void Poll(uword args); |
| 105 void WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data); | 105 void WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data); |
| 106 void HandleInterruptFd(); | 106 void HandleInterruptFd(); |
| 107 void SetPort(intptr_t fd, Dart_Port dart_port, intptr_t mask); | 107 void SetPort(intptr_t fd, Dart_Port dart_port, intptr_t mask); |
| 108 intptr_t GetPollEvents(intptr_t events, SocketData* sd); | 108 intptr_t GetPollEvents(intptr_t events, SocketData* sd); |
| 109 static void* GetHashmapKeyFromFd(intptr_t fd); | 109 static void* GetHashmapKeyFromFd(intptr_t fd); |
| 110 static uint32_t GetHashmapHashFromFd(intptr_t fd); | 110 static uint32_t GetHashmapHashFromFd(intptr_t fd); |
| 111 | 111 |
| 112 HashMap socket_map_; | 112 HashMap socket_map_; |
| 113 int64_t timeout_; // Time for next timeout. | 113 int64_t timeout_; // Time for next timeout. |
| 114 Dart_Port timeout_port_; | 114 Dart_Port timeout_port_; |
| 115 bool shutdown_; | 115 bool shutdown_; |
| 116 int interrupt_fds_[2]; | 116 int interrupt_fds_[2]; |
| 117 int epoll_fd_; | 117 int epoll_fd_; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 | 120 |
| 121 #endif // BIN_EVENTHANDLER_LINUX_H_ | 121 #endif // BIN_EVENTHANDLER_LINUX_H_ |
| OLD | NEW |