OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #include <unistd.h> | 8 #include <unistd.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 void Close() { | 45 void Close() { |
46 Unregister(); | 46 Unregister(); |
47 flags_ = 0; | 47 flags_ = 0; |
48 close(fd_); | 48 close(fd_); |
49 fd_ = 0; | 49 fd_ = 0; |
50 } | 50 } |
51 | 51 |
52 bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; } | 52 bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; } |
| 53 bool IsPipe() { return (mask_ & (1 << kPipe)) != 0; } |
53 bool IsClosedRead() { return (flags_ & (1 << kClosedRead)) != 0; } | 54 bool IsClosedRead() { return (flags_ & (1 << kClosedRead)) != 0; } |
54 bool IsClosedWrite() { return (flags_ & (1 << kClosedWrite)) != 0; } | 55 bool IsClosedWrite() { return (flags_ & (1 << kClosedWrite)) != 0; } |
55 | 56 |
56 void MarkClosedRead() { flags_ |= (1 << kClosedRead); } | 57 void MarkClosedRead() { flags_ |= (1 << kClosedRead); } |
57 void MarkClosedWrite() { flags_ |= (1 << kClosedWrite); } | 58 void MarkClosedWrite() { flags_ |= (1 << kClosedWrite); } |
58 | 59 |
59 bool HasPollEvents() { return mask_ != 0; } | 60 bool HasPollEvents() { return mask_ != 0; } |
60 | 61 |
61 void SetPortAndMask(Dart_Port port, intptr_t mask) { | 62 void SetPortAndMask(Dart_Port port, intptr_t mask) { |
62 port_ = port; | 63 port_ = port; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 100 |
100 SocketData* socket_map_; | 101 SocketData* socket_map_; |
101 intptr_t socket_map_size_; | 102 intptr_t socket_map_size_; |
102 int64_t timeout_; // Time for next timeout. | 103 int64_t timeout_; // Time for next timeout. |
103 Dart_Port timeout_port_; | 104 Dart_Port timeout_port_; |
104 int interrupt_fds_[2]; | 105 int interrupt_fds_[2]; |
105 }; | 106 }; |
106 | 107 |
107 | 108 |
108 #endif // BIN_EVENTHANDLER_MACOS_H_ | 109 #endif // BIN_EVENTHANDLER_MACOS_H_ |
OLD | NEW |