| 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_WIN_H_ | 5 #ifndef BIN_EVENTHANDLER_WIN_H_ |
| 6 #define BIN_EVENTHANDLER_WIN_H_ | 6 #define BIN_EVENTHANDLER_WIN_H_ |
| 7 | 7 |
| 8 #if !defined(BIN_EVENTHANDLER_H_) | 8 #if !defined(BIN_EVENTHANDLER_H_) |
| 9 #error Do not include eventhandler_win.h directly; use eventhandler.h instead. | 9 #error Do not include eventhandler_win.h directly; use eventhandler.h instead. |
| 10 #endif | 10 #endif |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 handle_->Unlock(); | 182 handle_->Unlock(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 private: | 185 private: |
| 186 Handle* handle_; | 186 Handle* handle_; |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 virtual ~Handle(); | 189 virtual ~Handle(); |
| 190 | 190 |
| 191 // Socket interface exposing normal socket operations. | 191 // Socket interface exposing normal socket operations. |
| 192 int Available(); | 192 intptr_t Available(); |
| 193 int Read(void* buffer, int num_bytes); | 193 intptr_t Read(void* buffer, intptr_t num_bytes); |
| 194 int RecvFrom( | 194 intptr_t RecvFrom(void* buffer, |
| 195 void* buffer, int num_bytes, struct sockaddr* sa, socklen_t addr_len); | 195 intptr_t num_bytes, |
| 196 virtual int Write(const void* buffer, int num_bytes); | 196 struct sockaddr* sa, |
| 197 virtual int SendTo(const void* buffer, | 197 socklen_t addr_len); |
| 198 int num_bytes, | 198 virtual intptr_t Write(const void* buffer, intptr_t num_bytes); |
| 199 struct sockaddr* sa, | 199 virtual intptr_t SendTo(const void* buffer, |
| 200 socklen_t sa_len); | 200 intptr_t num_bytes, |
| 201 struct sockaddr* sa, |
| 202 socklen_t sa_len); |
| 201 | 203 |
| 202 // Internal interface used by the event handler. | 204 // Internal interface used by the event handler. |
| 203 virtual bool IssueRead(); | 205 virtual bool IssueRead(); |
| 204 virtual bool IssueRecvFrom(); | 206 virtual bool IssueRecvFrom(); |
| 205 virtual bool IssueWrite(); | 207 virtual bool IssueWrite(); |
| 206 virtual bool IssueSendTo(struct sockaddr* sa, socklen_t sa_len); | 208 virtual bool IssueSendTo(struct sockaddr* sa, socklen_t sa_len); |
| 207 bool HasPendingRead(); | 209 bool HasPendingRead(); |
| 208 bool HasPendingWrite(); | 210 bool HasPendingWrite(); |
| 209 void ReadComplete(OverlappedBuffer* buffer); | 211 void ReadComplete(OverlappedBuffer* buffer); |
| 210 void RecvFromComplete(OverlappedBuffer* buffer); | 212 void RecvFromComplete(OverlappedBuffer* buffer); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 write_thread_running_(false), | 319 write_thread_running_(false), |
| 318 write_monitor_(new Monitor()) { | 320 write_monitor_(new Monitor()) { |
| 319 type_ = kStd; | 321 type_ = kStd; |
| 320 } | 322 } |
| 321 | 323 |
| 322 ~StdHandle() { | 324 ~StdHandle() { |
| 323 delete write_monitor_; | 325 delete write_monitor_; |
| 324 } | 326 } |
| 325 | 327 |
| 326 virtual void DoClose(); | 328 virtual void DoClose(); |
| 327 virtual int Write(const void* buffer, int num_bytes); | 329 virtual intptr_t Write(const void* buffer, intptr_t num_bytes); |
| 328 | 330 |
| 329 void WriteSyncCompleteAsync(); | 331 void WriteSyncCompleteAsync(); |
| 330 void RunWriteLoop(); | 332 void RunWriteLoop(); |
| 331 | 333 |
| 332 private: | 334 private: |
| 333 DWORD thread_wrote_; | 335 DWORD thread_wrote_; |
| 334 bool write_thread_exists_; | 336 bool write_thread_exists_; |
| 335 bool write_thread_running_; | 337 bool write_thread_running_; |
| 336 dart::Monitor* write_monitor_; | 338 dart::Monitor* write_monitor_; |
| 337 }; | 339 }; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 | 541 |
| 540 TimeoutQueue timeout_queue_; // Time for next timeout. | 542 TimeoutQueue timeout_queue_; // Time for next timeout. |
| 541 bool shutdown_; | 543 bool shutdown_; |
| 542 HANDLE completion_port_; | 544 HANDLE completion_port_; |
| 543 }; | 545 }; |
| 544 | 546 |
| 545 } // namespace bin | 547 } // namespace bin |
| 546 } // namespace dart | 548 } // namespace dart |
| 547 | 549 |
| 548 #endif // BIN_EVENTHANDLER_WIN_H_ | 550 #endif // BIN_EVENTHANDLER_WIN_H_ |
| OLD | NEW |