| 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_H_ | 5 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
| 6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ | 6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 serial::SendError write_cancel_reason() const { return write_cancel_reason_; } | 184 serial::SendError write_cancel_reason() const { return write_cancel_reason_; } |
| 185 | 185 |
| 186 bool write_canceled() const { return write_canceled_; } | 186 bool write_canceled() const { return write_canceled_; } |
| 187 | 187 |
| 188 const serial::ConnectionOptions& options() const { return options_; } | 188 const serial::ConnectionOptions& options() const { return options_; } |
| 189 | 189 |
| 190 // Possibly fixes up a serial port path name in a platform-specific manner. | 190 // Possibly fixes up a serial port path name in a platform-specific manner. |
| 191 static std::string MaybeFixUpPortName(const std::string& port_name); | 191 static std::string MaybeFixUpPortName(const std::string& port_name); |
| 192 | 192 |
| 193 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; |
| 194 // On Chrome OS, PermissionBrokerClient should be called on the UI thread. |
| 195 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; |
| 196 |
| 197 std::string port_; |
| 198 |
| 193 private: | 199 private: |
| 194 friend class base::RefCounted<SerialIoHandler>; | 200 friend class base::RefCounted<SerialIoHandler>; |
| 195 | 201 |
| 196 void MergeConnectionOptions(const serial::ConnectionOptions& options); | 202 void MergeConnectionOptions(const serial::ConnectionOptions& options); |
| 197 | 203 |
| 198 // Continues an Open operation on the FILE thread. | 204 // Continues an Open operation on the FILE thread. |
| 199 void StartOpen(const std::string& port, | 205 void StartOpen(const std::string& port, |
| 200 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); | 206 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); |
| 201 | 207 |
| 202 // Finalizes an Open operation (continued from StartOpen) on the IO thread. | 208 // Finalizes an Open operation (continued from StartOpen) on the IO thread. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 218 serial::ReceiveError read_cancel_reason_; | 224 serial::ReceiveError read_cancel_reason_; |
| 219 bool read_canceled_; | 225 bool read_canceled_; |
| 220 | 226 |
| 221 scoped_ptr<ReadOnlyBuffer> pending_write_buffer_; | 227 scoped_ptr<ReadOnlyBuffer> pending_write_buffer_; |
| 222 serial::SendError write_cancel_reason_; | 228 serial::SendError write_cancel_reason_; |
| 223 bool write_canceled_; | 229 bool write_canceled_; |
| 224 | 230 |
| 225 // Callback to handle the completion of a pending Open() request. | 231 // Callback to handle the completion of a pending Open() request. |
| 226 OpenCompleteCallback open_complete_; | 232 OpenCompleteCallback open_complete_; |
| 227 | 233 |
| 228 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; | |
| 229 // On Chrome OS, PermissionBrokerClient should be called on the UI thread. | |
| 230 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; | |
| 231 | |
| 232 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); | 234 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); |
| 233 }; | 235 }; |
| 234 | 236 |
| 235 } // namespace device | 237 } // namespace device |
| 236 | 238 |
| 237 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ | 239 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
| OLD | NEW |