OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_WIN_H_ | 5 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_WIN_H_ |
6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_WIN_H_ | 6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_WIN_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" |
10 #include "device/serial/serial_io_handler.h" | 12 #include "device/serial/serial_io_handler.h" |
11 | 13 |
12 namespace device { | 14 namespace device { |
13 | 15 |
14 class SerialIoHandlerWin : public SerialIoHandler, | 16 class SerialIoHandlerWin : public SerialIoHandler, |
15 public base::MessageLoopForIO::IOHandler { | 17 public base::MessageLoopForIO::IOHandler { |
16 protected: | 18 protected: |
17 // SerialIoHandler implementation. | 19 // SerialIoHandler implementation. |
18 void ReadImpl() override; | 20 void ReadImpl() override; |
19 void WriteImpl() override; | 21 void WriteImpl() override; |
20 void CancelReadImpl() override; | 22 void CancelReadImpl() override; |
21 void CancelWriteImpl() override; | 23 void CancelWriteImpl() override; |
22 bool ConfigurePortImpl() override; | 24 bool ConfigurePortImpl() override; |
23 bool Flush() const override; | 25 bool Flush() const override; |
24 serial::DeviceControlSignalsPtr GetControlSignals() const override; | 26 serial::DeviceControlSignalsPtr GetControlSignals() const override; |
25 bool SetControlSignals( | 27 bool SetControlSignals( |
26 const serial::HostControlSignals& control_signals) override; | 28 const serial::HostControlSignals& control_signals) override; |
27 serial::ConnectionInfoPtr GetPortInfo() const override; | 29 serial::ConnectionInfoPtr GetPortInfo() const override; |
28 bool PostOpen() override; | 30 bool PostOpen() override; |
29 | 31 |
30 private: | 32 private: |
31 friend class SerialIoHandler; | 33 friend class SerialIoHandler; |
32 | 34 |
33 explicit SerialIoHandlerWin( | 35 explicit SerialIoHandlerWin( |
34 scoped_refptr<base::MessageLoopProxy> file_thread_message_loop, | 36 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
35 scoped_refptr<base::MessageLoopProxy> ui_thread_message_loop); | 37 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner); |
36 ~SerialIoHandlerWin() override; | 38 ~SerialIoHandlerWin() override; |
37 | 39 |
38 // base::MessageLoopForIO::IOHandler implementation. | 40 // base::MessageLoopForIO::IOHandler implementation. |
39 void OnIOCompleted(base::MessageLoopForIO::IOContext* context, | 41 void OnIOCompleted(base::MessageLoopForIO::IOContext* context, |
40 DWORD bytes_transfered, | 42 DWORD bytes_transfered, |
41 DWORD error) override; | 43 DWORD error) override; |
42 | 44 |
43 // Context used for asynchronous WaitCommEvent calls. | 45 // Context used for asynchronous WaitCommEvent calls. |
44 scoped_ptr<base::MessageLoopForIO::IOContext> comm_context_; | 46 scoped_ptr<base::MessageLoopForIO::IOContext> comm_context_; |
45 | 47 |
(...skipping 10 matching lines...) Expand all Loading... |
56 // WaitCommEvent, as opposed to waiting on actual ReadFile completion | 58 // WaitCommEvent, as opposed to waiting on actual ReadFile completion |
57 // after a corresponding WaitCommEvent has completed. | 59 // after a corresponding WaitCommEvent has completed. |
58 bool is_comm_pending_; | 60 bool is_comm_pending_; |
59 | 61 |
60 DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerWin); | 62 DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerWin); |
61 }; | 63 }; |
62 | 64 |
63 } // namespace device | 65 } // namespace device |
64 | 66 |
65 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_WIN_H_ | 67 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_WIN_H_ |
OLD | NEW |