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/message_loop/message_loop.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 #include "dbus/file_descriptor.h" // nogncheck | 19 #include "dbus/file_descriptor.h" // nogncheck |
20 #endif // defined(OS_CHROMEOS) | 20 #endif // defined(OS_CHROMEOS) |
21 | 21 |
22 namespace device { | 22 namespace device { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
277 bool SerialIoHandler::ConfigurePort(const serial::ConnectionOptions& options) { | 277 bool SerialIoHandler::ConfigurePort(const serial::ConnectionOptions& options) { |
278 MergeConnectionOptions(options); | 278 MergeConnectionOptions(options); |
279 return ConfigurePortImpl(); | 279 return ConfigurePortImpl(); |
280 } | 280 } |
281 | 281 |
282 void SerialIoHandler::QueueReadCompleted(int bytes_read, | 282 void SerialIoHandler::QueueReadCompleted(int bytes_read, |
283 serial::ReceiveError error) { | 283 serial::ReceiveError error) { |
284 base::MessageLoop::current()->PostTask( | 284 base::ThreadTaskRunnerHandle::Get()->PostTask( |
285 FROM_HERE, | 285 FROM_HERE, |
286 base::Bind(&SerialIoHandler::ReadCompleted, this, bytes_read, error)); | 286 base::Bind(&SerialIoHandler::ReadCompleted, this, bytes_read, error)); |
287 } | 287 } |
288 | 288 |
289 void SerialIoHandler::QueueWriteCompleted(int bytes_written, | 289 void SerialIoHandler::QueueWriteCompleted(int bytes_written, |
290 serial::SendError error) { | 290 serial::SendError error) { |
291 base::MessageLoop::current()->PostTask( | 291 base::ThreadTaskRunnerHandle::Get()->PostTask( |
292 FROM_HERE, | 292 FROM_HERE, |
293 base::Bind(&SerialIoHandler::WriteCompleted, this, bytes_written, error)); | 293 base::Bind(&SerialIoHandler::WriteCompleted, this, bytes_written, error)); |
294 } | 294 } |
295 | 295 |
296 } // namespace device | 296 } // namespace device |
OLD | NEW |