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, command_bit) \ |
Søren Gjesse
2015/02/06 08:09:25
command_bit -> event_bit
kustermann
2015/02/06 09:36:47
Done.
| |
46 ((data & EVENT_MASK) == (1 << command_bit)) // NOLINT | |
39 #define TOKEN_COUNT(data) (data & ((1 << kCloseCommand) - 1)) | 47 #define TOKEN_COUNT(data) (data & ((1 << kCloseCommand) - 1)) |
40 | 48 |
41 class TimeoutQueue { | 49 class TimeoutQueue { |
42 private: | 50 private: |
43 class Timeout { | 51 class Timeout { |
44 public: | 52 public: |
45 Timeout(Dart_Port port, int64_t timeout, Timeout* next) | 53 Timeout(Dart_Port port, int64_t timeout, Timeout* next) |
46 : port_(port), timeout_(timeout), next_(next) {} | 54 : port_(port), timeout_(timeout), next_(next) {} |
47 | 55 |
48 Dart_Port port() const { return port_; } | 56 Dart_Port port() const { return port_; } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 | 219 |
212 private: | 220 private: |
213 friend class EventHandlerImplementation; | 221 friend class EventHandlerImplementation; |
214 EventHandlerImplementation delegate_; | 222 EventHandlerImplementation delegate_; |
215 }; | 223 }; |
216 | 224 |
217 } // namespace bin | 225 } // namespace bin |
218 } // namespace dart | 226 } // namespace dart |
219 | 227 |
220 #endif // BIN_EVENTHANDLER_H_ | 228 #endif // BIN_EVENTHANDLER_H_ |
OLD | NEW |