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 RUNTIME_BIN_EVENTHANDLER_WIN_H_ | 5 #ifndef RUNTIME_BIN_EVENTHANDLER_WIN_H_ |
6 #define RUNTIME_BIN_EVENTHANDLER_WIN_H_ | 6 #define RUNTIME_BIN_EVENTHANDLER_WIN_H_ |
7 | 7 |
8 #if !defined(RUNTIME_BIN_EVENTHANDLER_H_) | 8 #if !defined(RUNTIME_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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 virtual void EnsureInitialized(EventHandlerImplementation* event_handler); | 303 virtual void EnsureInitialized(EventHandlerImplementation* event_handler); |
304 virtual bool IsClosed(); | 304 virtual bool IsClosed(); |
305 | 305 |
306 private: | 306 private: |
307 DISALLOW_COPY_AND_ASSIGN(FileHandle); | 307 DISALLOW_COPY_AND_ASSIGN(FileHandle); |
308 }; | 308 }; |
309 | 309 |
310 | 310 |
311 class StdHandle : public FileHandle { | 311 class StdHandle : public FileHandle { |
312 public: | 312 public: |
| 313 static StdHandle* Stdin(HANDLE handle); |
| 314 |
| 315 virtual void DoClose(); |
| 316 virtual intptr_t Write(const void* buffer, intptr_t num_bytes); |
| 317 |
| 318 void WriteSyncCompleteAsync(); |
| 319 void RunWriteLoop(); |
| 320 |
| 321 #if defined(DEBUG) |
| 322 static StdHandle* StdinPtr() { return stdin_; } |
| 323 #endif |
| 324 |
| 325 private: |
| 326 static Mutex* stdin_mutex_; |
| 327 static StdHandle* stdin_; |
| 328 |
313 explicit StdHandle(HANDLE handle) | 329 explicit StdHandle(HANDLE handle) |
314 : FileHandle(handle), | 330 : FileHandle(handle), |
315 thread_id_(Thread::kInvalidThreadId), | 331 thread_id_(Thread::kInvalidThreadId), |
316 thread_handle_(NULL), | 332 thread_handle_(NULL), |
317 thread_wrote_(0), | 333 thread_wrote_(0), |
318 write_thread_exists_(false), | 334 write_thread_exists_(false), |
319 write_thread_running_(false) { | 335 write_thread_running_(false) { |
320 type_ = kStd; | 336 type_ = kStd; |
321 } | 337 } |
322 | 338 |
323 virtual void DoClose(); | |
324 virtual intptr_t Write(const void* buffer, intptr_t num_bytes); | |
325 | |
326 void WriteSyncCompleteAsync(); | |
327 void RunWriteLoop(); | |
328 | |
329 private: | |
330 ThreadId thread_id_; | 339 ThreadId thread_id_; |
331 HANDLE thread_handle_; | 340 HANDLE thread_handle_; |
332 intptr_t thread_wrote_; | 341 intptr_t thread_wrote_; |
333 bool write_thread_exists_; | 342 bool write_thread_exists_; |
334 bool write_thread_running_; | 343 bool write_thread_running_; |
335 | 344 |
336 DISALLOW_COPY_AND_ASSIGN(StdHandle); | 345 DISALLOW_COPY_AND_ASSIGN(StdHandle); |
337 }; | 346 }; |
338 | 347 |
339 | 348 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 bool shutdown_; | 575 bool shutdown_; |
567 HANDLE completion_port_; | 576 HANDLE completion_port_; |
568 | 577 |
569 DISALLOW_COPY_AND_ASSIGN(EventHandlerImplementation); | 578 DISALLOW_COPY_AND_ASSIGN(EventHandlerImplementation); |
570 }; | 579 }; |
571 | 580 |
572 } // namespace bin | 581 } // namespace bin |
573 } // namespace dart | 582 } // namespace dart |
574 | 583 |
575 #endif // RUNTIME_BIN_EVENTHANDLER_WIN_H_ | 584 #endif // RUNTIME_BIN_EVENTHANDLER_WIN_H_ |
OLD | NEW |