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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 HANDLE completion_port_; | 256 HANDLE completion_port_; |
257 EventHandlerImplementation* event_handler_; | 257 EventHandlerImplementation* event_handler_; |
258 | 258 |
259 OverlappedBuffer* data_ready_; // Buffer for data ready to be read. | 259 OverlappedBuffer* data_ready_; // Buffer for data ready to be read. |
260 OverlappedBuffer* pending_read_; // Buffer for pending read. | 260 OverlappedBuffer* pending_read_; // Buffer for pending read. |
261 OverlappedBuffer* pending_write_; // Buffer for pending write | 261 OverlappedBuffer* pending_write_; // Buffer for pending write |
262 | 262 |
263 DWORD last_error_; | 263 DWORD last_error_; |
264 | 264 |
265 ThreadId read_thread_id_; | 265 ThreadId read_thread_id_; |
| 266 HANDLE read_thread_handle_; |
266 bool read_thread_starting_; | 267 bool read_thread_starting_; |
267 bool read_thread_finished_; | 268 bool read_thread_finished_; |
268 | 269 |
269 private: | 270 private: |
270 void WaitForReadThreadStarted(); | 271 void WaitForReadThreadStarted(); |
271 void NotifyReadThreadStarted(); | 272 void NotifyReadThreadStarted(); |
272 void WaitForReadThreadFinished(); | 273 void WaitForReadThreadFinished(); |
273 void NotifyReadThreadFinished(); | 274 void NotifyReadThreadFinished(); |
274 | 275 |
275 int flags_; | 276 int flags_; |
(...skipping 15 matching lines...) Expand all Loading... |
291 private: | 292 private: |
292 DISALLOW_COPY_AND_ASSIGN(FileHandle); | 293 DISALLOW_COPY_AND_ASSIGN(FileHandle); |
293 }; | 294 }; |
294 | 295 |
295 | 296 |
296 class StdHandle : public FileHandle { | 297 class StdHandle : public FileHandle { |
297 public: | 298 public: |
298 explicit StdHandle(HANDLE handle) | 299 explicit StdHandle(HANDLE handle) |
299 : FileHandle(handle), | 300 : FileHandle(handle), |
300 thread_id_(Thread::kInvalidThreadId), | 301 thread_id_(Thread::kInvalidThreadId), |
| 302 thread_handle_(NULL), |
301 thread_wrote_(0), | 303 thread_wrote_(0), |
302 write_thread_exists_(false), | 304 write_thread_exists_(false), |
303 write_thread_running_(false) { | 305 write_thread_running_(false) { |
304 type_ = kStd; | 306 type_ = kStd; |
305 } | 307 } |
306 | 308 |
307 virtual void DoClose(); | 309 virtual void DoClose(); |
308 virtual intptr_t Write(const void* buffer, intptr_t num_bytes); | 310 virtual intptr_t Write(const void* buffer, intptr_t num_bytes); |
309 | 311 |
310 void WriteSyncCompleteAsync(); | 312 void WriteSyncCompleteAsync(); |
311 void RunWriteLoop(); | 313 void RunWriteLoop(); |
312 | 314 |
313 private: | 315 private: |
314 ThreadId thread_id_; | 316 ThreadId thread_id_; |
| 317 HANDLE thread_handle_; |
315 intptr_t thread_wrote_; | 318 intptr_t thread_wrote_; |
316 bool write_thread_exists_; | 319 bool write_thread_exists_; |
317 bool write_thread_running_; | 320 bool write_thread_running_; |
318 | 321 |
319 DISALLOW_COPY_AND_ASSIGN(StdHandle); | 322 DISALLOW_COPY_AND_ASSIGN(StdHandle); |
320 }; | 323 }; |
321 | 324 |
322 | 325 |
323 class DirectoryWatchHandle : public DescriptorInfoSingleMixin<Handle> { | 326 class DirectoryWatchHandle : public DescriptorInfoSingleMixin<Handle> { |
324 public: | 327 public: |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 OverlappedBuffer* buffer); | 534 OverlappedBuffer* buffer); |
532 void HandleIOCompletion(DWORD bytes, ULONG_PTR key, OVERLAPPED* overlapped); | 535 void HandleIOCompletion(DWORD bytes, ULONG_PTR key, OVERLAPPED* overlapped); |
533 | 536 |
534 HANDLE completion_port() { return completion_port_; } | 537 HANDLE completion_port() { return completion_port_; } |
535 | 538 |
536 private: | 539 private: |
537 ClientSocket* client_sockets_head_; | 540 ClientSocket* client_sockets_head_; |
538 | 541 |
539 Monitor* startup_monitor_; | 542 Monitor* startup_monitor_; |
540 ThreadId handler_thread_id_; | 543 ThreadId handler_thread_id_; |
| 544 HANDLE handler_thread_handle_; |
541 | 545 |
542 TimeoutQueue timeout_queue_; // Time for next timeout. | 546 TimeoutQueue timeout_queue_; // Time for next timeout. |
543 bool shutdown_; | 547 bool shutdown_; |
544 HANDLE completion_port_; | 548 HANDLE completion_port_; |
545 | 549 |
546 DISALLOW_COPY_AND_ASSIGN(EventHandlerImplementation); | 550 DISALLOW_COPY_AND_ASSIGN(EventHandlerImplementation); |
547 }; | 551 }; |
548 | 552 |
549 } // namespace bin | 553 } // namespace bin |
550 } // namespace dart | 554 } // namespace dart |
551 | 555 |
552 #endif // BIN_EVENTHANDLER_WIN_H_ | 556 #endif // BIN_EVENTHANDLER_WIN_H_ |
OLD | NEW |