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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 intptr_t mask() { return mask_; } | 204 intptr_t mask() { return mask_; } |
205 | 205 |
206 void MarkDoesNotSupportOverlappedIO() { | 206 void MarkDoesNotSupportOverlappedIO() { |
207 flags_ |= (1 << kDoesNotSupportOverlappedIO); | 207 flags_ |= (1 << kDoesNotSupportOverlappedIO); |
208 } | 208 } |
209 bool SupportsOverlappedIO() { | 209 bool SupportsOverlappedIO() { |
210 return (flags_ & (1 << kDoesNotSupportOverlappedIO)) == 0; | 210 return (flags_ & (1 << kDoesNotSupportOverlappedIO)) == 0; |
211 } | 211 } |
212 | 212 |
213 void ReadSyncCompleteAsync(); | 213 void ReadSyncCompleteAsync(); |
| 214 void WriteSyncCompleteAsync(); |
214 | 215 |
215 DWORD last_error() { return last_error_; } | 216 DWORD last_error() { return last_error_; } |
216 void set_last_error(DWORD last_error) { last_error_ = last_error; } | 217 void set_last_error(DWORD last_error) { last_error_ = last_error; } |
217 | 218 |
218 protected: | 219 protected: |
219 enum Flags { | 220 enum Flags { |
220 kClosing = 0, | 221 kClosing = 0, |
221 kCloseRead = 1, | 222 kCloseRead = 1, |
222 kCloseWrite = 2, | 223 kCloseWrite = 2, |
223 kDoesNotSupportOverlappedIO = 3, | 224 kDoesNotSupportOverlappedIO = 3, |
(...skipping 10 matching lines...) Expand all Loading... |
234 Dart_Port port_; // Dart port to communicate events for this socket. | 235 Dart_Port port_; // Dart port to communicate events for this socket. |
235 intptr_t mask_; // Mask of events to report through the port. | 236 intptr_t mask_; // Mask of events to report through the port. |
236 HANDLE completion_port_; | 237 HANDLE completion_port_; |
237 EventHandlerImplementation* event_handler_; | 238 EventHandlerImplementation* event_handler_; |
238 | 239 |
239 OverlappedBuffer* data_ready_; // Buffer for data ready to be read. | 240 OverlappedBuffer* data_ready_; // Buffer for data ready to be read. |
240 OverlappedBuffer* pending_read_; // Buffer for pending read. | 241 OverlappedBuffer* pending_read_; // Buffer for pending read. |
241 OverlappedBuffer* pending_write_; // Buffer for pending write | 242 OverlappedBuffer* pending_write_; // Buffer for pending write |
242 | 243 |
243 DWORD last_error_; | 244 DWORD last_error_; |
| 245 DWORD thread_wrote_; |
244 | 246 |
245 private: | 247 private: |
246 int flags_; | 248 int flags_; |
247 CRITICAL_SECTION cs_; // Critical section protecting this object. | 249 CRITICAL_SECTION cs_; // Critical section protecting this object. |
248 }; | 250 }; |
249 | 251 |
250 | 252 |
251 class FileHandle : public Handle { | 253 class FileHandle : public Handle { |
252 public: | 254 public: |
253 explicit FileHandle(HANDLE handle) | 255 explicit FileHandle(HANDLE handle) |
(...skipping 11 matching lines...) Expand all Loading... |
265 public: | 267 public: |
266 DirectoryWatchHandle(HANDLE handle, int events, bool recursive) | 268 DirectoryWatchHandle(HANDLE handle, int events, bool recursive) |
267 : Handle(handle), | 269 : Handle(handle), |
268 events_(events), | 270 events_(events), |
269 recursive_(recursive) { | 271 recursive_(recursive) { |
270 type_ = kDirectoryWatch; | 272 type_ = kDirectoryWatch; |
271 } | 273 } |
272 | 274 |
273 virtual void EnsureInitialized(EventHandlerImplementation* event_handler); | 275 virtual void EnsureInitialized(EventHandlerImplementation* event_handler); |
274 virtual bool IsClosed(); | 276 virtual bool IsClosed(); |
275 virtual void DoClose(); | |
276 | 277 |
277 virtual bool IssueRead(); | 278 virtual bool IssueRead(); |
278 | 279 |
279 private: | 280 private: |
280 int events_; | 281 int events_; |
281 bool recursive_; | 282 bool recursive_; |
282 }; | 283 }; |
283 | 284 |
284 | 285 |
285 class SocketHandle : public Handle { | 286 class SocketHandle : public Handle { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 420 |
420 TimeoutQueue timeout_queue_; // Time for next timeout. | 421 TimeoutQueue timeout_queue_; // Time for next timeout. |
421 bool shutdown_; | 422 bool shutdown_; |
422 HANDLE completion_port_; | 423 HANDLE completion_port_; |
423 }; | 424 }; |
424 | 425 |
425 } // namespace bin | 426 } // namespace bin |
426 } // namespace dart | 427 } // namespace dart |
427 | 428 |
428 #endif // BIN_EVENTHANDLER_WIN_H_ | 429 #endif // BIN_EVENTHANDLER_WIN_H_ |
OLD | NEW |