| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/files/file_descriptor_watcher_posix.h" | 10 #include "base/files/file_descriptor_watcher_posix.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 int buffer_len, | 40 int buffer_len, |
| 41 int bytes_read, | 41 int bytes_read, |
| 42 bool& break_detected, | 42 bool& break_detected, |
| 43 bool& parity_error_detected); | 43 bool& parity_error_detected); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 friend class SerialIoHandler; | 46 friend class SerialIoHandler; |
| 47 friend class SerialIoHandlerPosixTest; | 47 friend class SerialIoHandlerPosixTest; |
| 48 | 48 |
| 49 SerialIoHandlerPosix( | 49 SerialIoHandlerPosix( |
| 50 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, | |
| 51 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner); | 50 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner); |
| 52 ~SerialIoHandlerPosix() override; | 51 ~SerialIoHandlerPosix() override; |
| 53 | 52 |
| 54 void AttemptRead(bool within_read); | 53 void AttemptRead(bool within_read); |
| 55 void RunReadCompleted(bool within_read, | 54 void RunReadCompleted(bool within_read, |
| 56 int bytes_read, | 55 int bytes_read, |
| 57 serial::ReceiveError error); | 56 serial::ReceiveError error); |
| 58 | 57 |
| 59 // Called when file() is writable without blocking. | 58 // Called when file() is writable without blocking. |
| 60 void OnFileCanWriteWithoutBlocking(); | 59 void OnFileCanWriteWithoutBlocking(); |
| 61 | 60 |
| 62 void EnsureWatchingReads(); | 61 void EnsureWatchingReads(); |
| 63 void EnsureWatchingWrites(); | 62 void EnsureWatchingWrites(); |
| 64 | 63 |
| 65 std::unique_ptr<base::FileDescriptorWatcher::Controller> file_read_watcher_; | 64 std::unique_ptr<base::FileDescriptorWatcher::Controller> file_read_watcher_; |
| 66 std::unique_ptr<base::FileDescriptorWatcher::Controller> file_write_watcher_; | 65 std::unique_ptr<base::FileDescriptorWatcher::Controller> file_write_watcher_; |
| 67 | 66 |
| 68 ErrorDetectState error_detect_state_; | 67 ErrorDetectState error_detect_state_; |
| 69 bool parity_check_enabled_; | 68 bool parity_check_enabled_; |
| 70 char chars_stashed_[2]; | 69 char chars_stashed_[2]; |
| 71 int num_chars_stashed_; | 70 int num_chars_stashed_; |
| 72 | 71 |
| 73 DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerPosix); | 72 DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerPosix); |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 } // namespace device | 75 } // namespace device |
| 77 | 76 |
| 78 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_ | 77 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_POSIX_H_ |
| OLD | NEW |