| 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_POSIX_H_ | 5 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_ |
| 6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_ | 6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.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" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 friend class SerialIoHandler; | 44 friend class SerialIoHandler; |
| 45 friend class SerialIoHandlerPosixTest; | 45 friend class SerialIoHandlerPosixTest; |
| 46 | 46 |
| 47 SerialIoHandlerPosix( | 47 SerialIoHandlerPosix( |
| 48 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, | 48 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
| 49 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner); | 49 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner); |
| 50 ~SerialIoHandlerPosix() override; | 50 ~SerialIoHandlerPosix() override; |
| 51 | 51 |
| 52 void AttemptRead(bool within_read); |
| 53 void RunReadCompleted(bool within_read, |
| 54 int bytes_read, |
| 55 serial::ReceiveError error); |
| 56 |
| 52 // base::MessageLoopForIO::Watcher implementation. | 57 // base::MessageLoopForIO::Watcher implementation. |
| 53 void OnFileCanWriteWithoutBlocking(int fd) override; | 58 void OnFileCanWriteWithoutBlocking(int fd) override; |
| 54 void OnFileCanReadWithoutBlocking(int fd) override; | 59 void OnFileCanReadWithoutBlocking(int fd) override; |
| 55 | 60 |
| 56 void EnsureWatchingReads(); | 61 void EnsureWatchingReads(); |
| 57 void EnsureWatchingWrites(); | 62 void EnsureWatchingWrites(); |
| 58 | 63 |
| 59 base::MessageLoopForIO::FileDescriptorWatcher file_read_watcher_; | 64 base::MessageLoopForIO::FileDescriptorWatcher file_read_watcher_; |
| 60 base::MessageLoopForIO::FileDescriptorWatcher file_write_watcher_; | 65 base::MessageLoopForIO::FileDescriptorWatcher file_write_watcher_; |
| 61 | 66 |
| 62 // Flags indicating if the message loop is watching the device for IO events. | 67 // Flags indicating if the message loop is watching the device for IO events. |
| 63 bool is_watching_reads_; | 68 bool is_watching_reads_; |
| 64 bool is_watching_writes_; | 69 bool is_watching_writes_; |
| 65 | 70 |
| 66 ErrorDetectState error_detect_state_; | 71 ErrorDetectState error_detect_state_; |
| 67 bool parity_check_enabled_; | 72 bool parity_check_enabled_; |
| 68 char chars_stashed_[2]; | 73 char chars_stashed_[2]; |
| 69 int num_chars_stashed_; | 74 int num_chars_stashed_; |
| 70 | 75 |
| 71 DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerPosix); | 76 DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerPosix); |
| 72 }; | 77 }; |
| 73 | 78 |
| 74 } // namespace device | 79 } // namespace device |
| 75 | 80 |
| 76 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_ | 81 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_ |
| OLD | NEW |