| 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_ANDROID_H_ | 5 #ifndef BIN_EVENTHANDLER_ANDROID_H_ |
| 6 #define BIN_EVENTHANDLER_ANDROID_H_ | 6 #define BIN_EVENTHANDLER_ANDROID_H_ |
| 7 | 7 |
| 8 #if !defined(BIN_EVENTHANDLER_H_) | 8 #if !defined(BIN_EVENTHANDLER_H_) |
| 9 #error Do not include eventhandler_android.h directly; | 9 #error Do not include eventhandler_android.h directly; |
| 10 #error use eventhandler.h instead. | 10 #error use eventhandler.h instead. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 | 75 |
| 76 class EventHandlerImplementation { | 76 class EventHandlerImplementation { |
| 77 public: | 77 public: |
| 78 EventHandlerImplementation(); | 78 EventHandlerImplementation(); |
| 79 ~EventHandlerImplementation(); | 79 ~EventHandlerImplementation(); |
| 80 | 80 |
| 81 // Gets the socket data structure for a given file | 81 // Gets the socket data structure for a given file |
| 82 // descriptor. Creates a new one if one is not found. | 82 // descriptor. Creates a new one if one is not found. |
| 83 SocketData* GetSocketData(intptr_t fd, bool* is_new); | 83 SocketData* GetSocketData(intptr_t fd, bool* is_new); |
| 84 void SendData(intptr_t id, Dart_Port dart_port, intptr_t data); | 84 void Notify(intptr_t id, Dart_Port dart_port, intptr_t data); |
| 85 void Start(EventHandler* handler); | 85 void Start(EventHandler* handler); |
| 86 void Shutdown(); | 86 void Shutdown(); |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 int64_t GetTimeout(); | 89 int64_t GetTimeout(); |
| 90 void HandleEvents(struct epoll_event* events, int size); | 90 void HandleEvents(struct epoll_event* events, int size); |
| 91 void HandleTimeout(); | 91 void HandleTimeout(); |
| 92 static void Poll(uword args); | 92 static void Poll(uword args); |
| 93 void WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data); | 93 void WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data); |
| 94 void HandleInterruptFd(); | 94 void HandleInterruptFd(); |
| 95 void SetPort(intptr_t fd, Dart_Port dart_port, intptr_t mask); | 95 void SetPort(intptr_t fd, Dart_Port dart_port, intptr_t mask); |
| 96 intptr_t GetPollEvents(intptr_t events, SocketData* sd); | 96 intptr_t GetPollEvents(intptr_t events, SocketData* sd); |
| 97 static void* GetHashmapKeyFromFd(intptr_t fd); | 97 static void* GetHashmapKeyFromFd(intptr_t fd); |
| 98 static uint32_t GetHashmapHashFromFd(intptr_t fd); | 98 static uint32_t GetHashmapHashFromFd(intptr_t fd); |
| 99 | 99 |
| 100 HashMap socket_map_; | 100 HashMap socket_map_; |
| 101 TimeoutQueue timeout_queue_; | 101 TimeoutQueue timeout_queue_; |
| 102 bool shutdown_; | 102 bool shutdown_; |
| 103 int interrupt_fds_[2]; | 103 int interrupt_fds_[2]; |
| 104 int epoll_fd_; | 104 int epoll_fd_; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 } // namespace bin | 107 } // namespace bin |
| 108 } // namespace dart | 108 } // namespace dart |
| 109 | 109 |
| 110 #endif // BIN_EVENTHANDLER_ANDROID_H_ | 110 #endif // BIN_EVENTHANDLER_ANDROID_H_ |
| OLD | NEW |