| 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 #include "device/serial/serial_io_handler.h" | 5 #include "device/serial/serial_io_handler.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 | 15 |
| 16 #if defined(OS_CHROMEOS) | 16 #if defined(OS_CHROMEOS) |
| 17 #include "chromeos/dbus/dbus_thread_manager.h" | 17 #include "chromeos/dbus/dbus_thread_manager.h" |
| 18 #include "chromeos/dbus/permission_broker_client.h" | 18 #include "chromeos/dbus/permission_broker_client.h" |
| 19 #endif // defined(OS_CHROMEOS) | 19 #endif // defined(OS_CHROMEOS) |
| 20 | 20 |
| 21 namespace device { | 21 namespace device { |
| 22 | 22 |
| 23 SerialIoHandler::SerialIoHandler( | 23 SerialIoHandler::SerialIoHandler( |
| 24 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, | 24 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
| 25 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner) | 25 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner) |
| 26 : file_thread_task_runner_(file_thread_task_runner), | 26 : file_thread_task_runner_(file_thread_task_runner), |
| 27 ui_thread_task_runner_(ui_thread_task_runner) { | 27 ui_thread_task_runner_(ui_thread_task_runner) { |
| 28 options_.bitrate = 9600; | 28 options_.bitrate = 9600; |
| 29 options_.data_bits = serial::DataBits::EIGHT; | 29 options_.data_bits = serial::DataBits::EIGHT; |
| 30 options_.parity_bit = serial::ParityBit::NO; | 30 options_.parity_bit = serial::ParityBit::NO_PARITY; |
| 31 options_.stop_bits = serial::StopBits::ONE; | 31 options_.stop_bits = serial::StopBits::ONE; |
| 32 options_.cts_flow_control = false; | 32 options_.cts_flow_control = false; |
| 33 options_.has_cts_flow_control = true; | 33 options_.has_cts_flow_control = true; |
| 34 } | 34 } |
| 35 | 35 |
| 36 SerialIoHandler::~SerialIoHandler() { | 36 SerialIoHandler::~SerialIoHandler() { |
| 37 DCHECK(CalledOnValidThread()); | 37 DCHECK(CalledOnValidThread()); |
| 38 Close(); | 38 Close(); |
| 39 } | 39 } |
| 40 | 40 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 270 } |
| 271 | 271 |
| 272 void SerialIoHandler::QueueWriteCompleted(int bytes_written, | 272 void SerialIoHandler::QueueWriteCompleted(int bytes_written, |
| 273 serial::SendError error) { | 273 serial::SendError error) { |
| 274 base::ThreadTaskRunnerHandle::Get()->PostTask( | 274 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 275 FROM_HERE, | 275 FROM_HERE, |
| 276 base::Bind(&SerialIoHandler::WriteCompleted, this, bytes_written, error)); | 276 base::Bind(&SerialIoHandler::WriteCompleted, this, bytes_written, error)); |
| 277 } | 277 } |
| 278 | 278 |
| 279 } // namespace device | 279 } // namespace device |
| OLD | NEW |