| 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_H_ | 5 #ifndef BIN_EVENTHANDLER_H_ |
| 6 #define BIN_EVENTHANDLER_H_ | 6 #define BIN_EVENTHANDLER_H_ |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/isolate_data.h" | 9 #include "bin/isolate_data.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 namespace bin { | 12 namespace bin { |
| 13 | 13 |
| 14 // Flags used to provide information and actions to the eventhandler | 14 // Flags used to provide information and actions to the eventhandler |
| 15 // when sending a message about a file descriptor. These flags should | 15 // when sending a message about a file descriptor. These flags should |
| 16 // be kept in sync with the constants in socket_impl.dart. For more | 16 // be kept in sync with the constants in socket_impl.dart. For more |
| 17 // information see the comments in socket_impl.dart | 17 // information see the comments in socket_impl.dart |
| 18 enum MessageFlags { | 18 enum MessageFlags { |
| 19 kInEvent = 0, | 19 kInEvent = 0, |
| 20 kOutEvent = 1, | 20 kOutEvent = 1, |
| 21 kErrorEvent = 2, | 21 kErrorEvent = 2, |
| 22 kCloseEvent = 3, | 22 kCloseEvent = 3, |
| 23 kDestroyedEvent = 4, | 23 kDestroyedEvent = 4, |
| 24 kCloseCommand = 8, | 24 kCloseCommand = 8, |
| 25 kShutdownReadCommand = 9, | 25 kShutdownReadCommand = 9, |
| 26 kShutdownWriteCommand = 10, | 26 kShutdownWriteCommand = 10, |
| 27 kReturnTokenCommand = 11, | 27 kReturnTokenCommand = 11, |
| 28 kSetEventMaskCommand = 12, |
| 28 kListeningSocket = 16, | 29 kListeningSocket = 16, |
| 29 kPipe = 17, | 30 kPipe = 17, |
| 30 }; | 31 }; |
| 31 | 32 |
| 32 #define COMMAND_MASK ((1 << kCloseCommand) | \ | 33 #define COMMAND_MASK ((1 << kCloseCommand) | \ |
| 33 (1 << kShutdownReadCommand) | \ | 34 (1 << kShutdownReadCommand) | \ |
| 34 (1 << kShutdownWriteCommand) | \ | 35 (1 << kShutdownWriteCommand) | \ |
| 35 (1 << kReturnTokenCommand)) | 36 (1 << kReturnTokenCommand) | \ |
| 37 (1 << kSetEventMaskCommand)) |
| 38 #define EVENT_MASK ((1 << kInEvent) | \ |
| 39 (1 << kOutEvent) | \ |
| 40 (1 << kErrorEvent) | \ |
| 41 (1 << kCloseEvent) | \ |
| 42 (1 << kDestroyedEvent)) |
| 36 #define IS_COMMAND(data, command_bit) \ | 43 #define IS_COMMAND(data, command_bit) \ |
| 37 ((data & COMMAND_MASK) == (1 << command_bit)) // NOLINT | 44 ((data & COMMAND_MASK) == (1 << command_bit)) // NOLINT |
| 38 #define ASSERT_NO_COMMAND(data) ASSERT((data & COMMAND_MASK) == 0) // NOLINT | 45 #define IS_EVENT(data, event_bit) \ |
| 46 ((data & EVENT_MASK) == (1 << event_bit)) // NOLINT |
| 47 #define IS_LISTENING_SOCKET(data) \ |
| 48 ((data & (1 << kListeningSocket)) != 0) // NOLINT |
| 39 #define TOKEN_COUNT(data) (data & ((1 << kCloseCommand) - 1)) | 49 #define TOKEN_COUNT(data) (data & ((1 << kCloseCommand) - 1)) |
| 40 | 50 |
| 41 class TimeoutQueue { | 51 class TimeoutQueue { |
| 42 private: | 52 private: |
| 43 class Timeout { | 53 class Timeout { |
| 44 public: | 54 public: |
| 45 Timeout(Dart_Port port, int64_t timeout, Timeout* next) | 55 Timeout(Dart_Port port, int64_t timeout, Timeout* next) |
| 46 : port_(port), timeout_(timeout), next_(next) {} | 56 : port_(port), timeout_(timeout), next_(next) {} |
| 47 | 57 |
| 48 Dart_Port port() const { return port_; } | 58 Dart_Port port() const { return port_; } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 221 |
| 212 private: | 222 private: |
| 213 friend class EventHandlerImplementation; | 223 friend class EventHandlerImplementation; |
| 214 EventHandlerImplementation delegate_; | 224 EventHandlerImplementation delegate_; |
| 215 }; | 225 }; |
| 216 | 226 |
| 217 } // namespace bin | 227 } // namespace bin |
| 218 } // namespace dart | 228 } // namespace dart |
| 219 | 229 |
| 220 #endif // BIN_EVENTHANDLER_H_ | 230 #endif // BIN_EVENTHANDLER_H_ |
| OLD | NEW |