Index: device/serial/serial_io_handler.cc |
diff --git a/device/serial/serial_io_handler.cc b/device/serial/serial_io_handler.cc |
index b73d532d09ebb797263095e4f264799ceb74cb99..1c614364d6794c7791bfef646c6c9b6f29c4aacf 100644 |
--- a/device/serial/serial_io_handler.cc |
+++ b/device/serial/serial_io_handler.cc |
@@ -21,10 +21,8 @@ |
namespace device { |
SerialIoHandler::SerialIoHandler( |
- scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner) |
- : file_thread_task_runner_(file_thread_task_runner), |
- ui_thread_task_runner_(ui_thread_task_runner) { |
+ : ui_thread_task_runner_(ui_thread_task_runner) { |
options_.bitrate = 9600; |
options_.data_bits = serial::DataBits::EIGHT; |
options_.parity_bit = serial::ParityBit::NO_PARITY; |
@@ -35,7 +33,6 @@ SerialIoHandler::SerialIoHandler( |
SerialIoHandler::~SerialIoHandler() { |
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
- Close(); |
} |
void SerialIoHandler::Open(const std::string& port, |
@@ -44,7 +41,6 @@ void SerialIoHandler::Open(const std::string& port, |
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
DCHECK(open_complete_.is_null()); |
open_complete_ = callback; |
- DCHECK(file_thread_task_runner_.get()); |
DCHECK(ui_thread_task_runner_.get()); |
MergeConnectionOptions(options); |
port_ = port; |
@@ -62,10 +58,6 @@ void SerialIoHandler::Open(const std::string& port, |
&chromeos::PermissionBrokerClient::OpenPath, base::Unretained(client), |
port, base::Bind(&SerialIoHandler::OnPathOpened, this, task_runner), |
base::Bind(&SerialIoHandler::OnPathOpenError, this, task_runner))); |
-#else |
- file_thread_task_runner_->PostTask( |
- FROM_HERE, base::Bind(&SerialIoHandler::StartOpen, this, port, |
- base::ThreadTaskRunnerHandle::Get())); |
Reilly Grant (use Gerrit)
2017/06/01 13:48:21
file_thread_task_runner_ is clearly used here so t
sujith
2017/06/01 14:57:31
Done.
|
#endif // defined(OS_CHROMEOS) |
} |
@@ -126,7 +118,6 @@ void SerialIoHandler::StartOpen( |
const std::string& port, |
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) { |
DCHECK(!open_complete_.is_null()); |
- DCHECK(file_thread_task_runner_->RunsTasksInCurrentSequence()); |
DCHECK(!file_.IsValid()); |
// It's the responsibility of the API wrapper around SerialIoHandler to |
// validate the supplied path against the set of valid port names, and |
@@ -158,8 +149,6 @@ void SerialIoHandler::FinishOpen(base::File file) { |
file_ = std::move(file); |
bool success = PostOpen() && ConfigurePortImpl(); |
- if (!success) |
- Close(); |
callback.Run(success); |
} |
@@ -168,15 +157,6 @@ bool SerialIoHandler::PostOpen() { |
return true; |
} |
-void SerialIoHandler::Close() { |
- if (file_.IsValid()) { |
- DCHECK(file_thread_task_runner_.get()); |
- file_thread_task_runner_->PostTask( |
Reilly Grant (use Gerrit)
2017/06/01 13:48:21
Same here. We can't just remove the Close method.
sujith
2017/06/01 14:57:31
Done.
|
- FROM_HERE, |
- base::Bind(&SerialIoHandler::DoClose, Passed(std::move(file_)))); |
- } |
-} |
- |
// static |
void SerialIoHandler::DoClose(base::File port) { |
// port closed by destructor. |