| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 268   HANDLE handle_; | 268   HANDLE handle_; | 
| 269   HANDLE completion_port_; | 269   HANDLE completion_port_; | 
| 270   EventHandlerImplementation* event_handler_; | 270   EventHandlerImplementation* event_handler_; | 
| 271 | 271 | 
| 272   OverlappedBuffer* data_ready_;  // Buffer for data ready to be read. | 272   OverlappedBuffer* data_ready_;  // Buffer for data ready to be read. | 
| 273   OverlappedBuffer* pending_read_;  // Buffer for pending read. | 273   OverlappedBuffer* pending_read_;  // Buffer for pending read. | 
| 274   OverlappedBuffer* pending_write_;  // Buffer for pending write | 274   OverlappedBuffer* pending_write_;  // Buffer for pending write | 
| 275 | 275 | 
| 276   DWORD last_error_; | 276   DWORD last_error_; | 
| 277 | 277 | 
|  | 278   ThreadId read_thread_id_; | 
|  | 279   bool read_thread_exists_; | 
|  | 280   Monitor* read_thread_monitor_; | 
|  | 281 | 
| 278  private: | 282  private: | 
| 279   int flags_; | 283   int flags_; | 
| 280   CRITICAL_SECTION cs_;  // Critical section protecting this object. | 284   CRITICAL_SECTION cs_;  // Critical section protecting this object. | 
| 281 }; | 285 }; | 
| 282 | 286 | 
| 283 | 287 | 
| 284 class FileHandle : public DescriptorInfoSingleMixin<Handle> { | 288 class FileHandle : public DescriptorInfoSingleMixin<Handle> { | 
| 285  public: | 289  public: | 
| 286   explicit FileHandle(HANDLE handle) | 290   explicit FileHandle(HANDLE handle) | 
| 287       : DescriptorInfoSingleMixin(reinterpret_cast<intptr_t>(handle), true) { | 291       : DescriptorInfoSingleMixin(reinterpret_cast<intptr_t>(handle), true) { | 
| 288     type_ = kFile; | 292     type_ = kFile; | 
| 289   } | 293   } | 
| 290 | 294 | 
| 291   virtual void EnsureInitialized(EventHandlerImplementation* event_handler); | 295   virtual void EnsureInitialized(EventHandlerImplementation* event_handler); | 
| 292   virtual bool IsClosed(); | 296   virtual bool IsClosed(); | 
| 293 }; | 297 }; | 
| 294 | 298 | 
| 295 | 299 | 
| 296 class StdHandle : public FileHandle { | 300 class StdHandle : public FileHandle { | 
| 297  public: | 301  public: | 
| 298   explicit StdHandle(HANDLE handle) | 302   explicit StdHandle(HANDLE handle) | 
| 299       : FileHandle(handle), | 303       : FileHandle(handle), | 
|  | 304         thread_id_(Thread::kInvalidThreadId), | 
| 300         thread_wrote_(0), | 305         thread_wrote_(0), | 
| 301         write_thread_exists_(false), | 306         write_thread_exists_(false), | 
| 302         write_thread_running_(false), | 307         write_thread_running_(false), | 
| 303         write_monitor_(new Monitor()) { | 308         write_monitor_(new Monitor()) { | 
| 304     type_ = kStd; | 309     type_ = kStd; | 
| 305   } | 310   } | 
| 306 | 311 | 
| 307   ~StdHandle() { | 312   ~StdHandle() { | 
| 308     delete write_monitor_; | 313     delete write_monitor_; | 
| 309   } | 314   } | 
| 310 | 315 | 
| 311   virtual void DoClose(); | 316   virtual void DoClose(); | 
| 312   virtual intptr_t Write(const void* buffer, intptr_t num_bytes); | 317   virtual intptr_t Write(const void* buffer, intptr_t num_bytes); | 
| 313 | 318 | 
| 314   void WriteSyncCompleteAsync(); | 319   void WriteSyncCompleteAsync(); | 
| 315   void RunWriteLoop(); | 320   void RunWriteLoop(); | 
| 316 | 321 | 
| 317  private: | 322  private: | 
|  | 323   ThreadId thread_id_; | 
| 318   intptr_t thread_wrote_; | 324   intptr_t thread_wrote_; | 
| 319   bool write_thread_exists_; | 325   bool write_thread_exists_; | 
| 320   bool write_thread_running_; | 326   bool write_thread_running_; | 
| 321   Monitor* write_monitor_; | 327   Monitor* write_monitor_; | 
| 322 }; | 328 }; | 
| 323 | 329 | 
| 324 | 330 | 
| 325 class DirectoryWatchHandle : public DescriptorInfoSingleMixin<Handle> { | 331 class DirectoryWatchHandle : public DescriptorInfoSingleMixin<Handle> { | 
| 326  public: | 332  public: | 
| 327   DirectoryWatchHandle(HANDLE handle, int events, bool recursive) | 333   DirectoryWatchHandle(HANDLE handle, int events, bool recursive) | 
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 519   void HandleConnect(ClientSocket* client_socket, | 525   void HandleConnect(ClientSocket* client_socket, | 
| 520                      int bytes, | 526                      int bytes, | 
| 521                      OverlappedBuffer* buffer); | 527                      OverlappedBuffer* buffer); | 
| 522   void HandleIOCompletion(DWORD bytes, ULONG_PTR key, OVERLAPPED* overlapped); | 528   void HandleIOCompletion(DWORD bytes, ULONG_PTR key, OVERLAPPED* overlapped); | 
| 523 | 529 | 
| 524   HANDLE completion_port() { return completion_port_; } | 530   HANDLE completion_port() { return completion_port_; } | 
| 525 | 531 | 
| 526  private: | 532  private: | 
| 527   ClientSocket* client_sockets_head_; | 533   ClientSocket* client_sockets_head_; | 
| 528 | 534 | 
|  | 535   Monitor* startup_monitor_; | 
|  | 536   ThreadId handler_thread_id_; | 
|  | 537 | 
| 529   TimeoutQueue timeout_queue_;  // Time for next timeout. | 538   TimeoutQueue timeout_queue_;  // Time for next timeout. | 
| 530   bool shutdown_; | 539   bool shutdown_; | 
| 531   HANDLE completion_port_; | 540   HANDLE completion_port_; | 
| 532 }; | 541 }; | 
| 533 | 542 | 
| 534 }  // namespace bin | 543 }  // namespace bin | 
| 535 }  // namespace dart | 544 }  // namespace dart | 
| 536 | 545 | 
| 537 #endif  // BIN_EVENTHANDLER_WIN_H_ | 546 #endif  // BIN_EVENTHANDLER_WIN_H_ | 
| OLD | NEW | 
|---|