Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(926)

Unified Diff: device/serial/serial_connection_factory.cc

Issue 873903002: Set serial connection parameters immediately on connect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a comment explaing the "set" notation. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/serial/serial_io_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/serial/serial_connection_factory.cc
diff --git a/device/serial/serial_connection_factory.cc b/device/serial/serial_connection_factory.cc
index 3e309b46ca4fdf908f9b19f57bed4c4f02f8441b..6b01490ecab7d08691ce7650de7cdb8a70291b2f 100644
--- a/device/serial/serial_connection_factory.cc
+++ b/device/serial/serial_connection_factory.cc
@@ -95,6 +95,10 @@ SerialConnectionFactory::ConnectTask::ConnectTask(
connection_request_(connection_request.Pass()),
sink_(sink.Pass()),
source_(source.Pass()) {
+ if (!options_) {
+ options_ = serial::ConnectionOptions::New();
+ }
+ FillDefaultConnectionOptions(options_.get());
}
void SerialConnectionFactory::ConnectTask::Run() {
@@ -109,19 +113,16 @@ SerialConnectionFactory::ConnectTask::~ConnectTask() {
void SerialConnectionFactory::ConnectTask::Connect() {
io_handler_ = factory_->io_handler_factory_.Run();
io_handler_->Open(
- path_,
+ path_, *options_,
base::Bind(&SerialConnectionFactory::ConnectTask::OnConnected, this));
}
void SerialConnectionFactory::ConnectTask::OnConnected(bool success) {
DCHECK(io_handler_.get());
- if (!success)
- return;
- if (!options_)
- options_ = serial::ConnectionOptions::New();
- FillDefaultConnectionOptions(options_.get());
- if (!io_handler_->ConfigurePort(*options_))
+ if (!success) {
return;
+ }
+
mojo::BindToRequest(
new SerialConnection(io_handler_, sink_.Pass(), source_.Pass()),
&connection_request_);
« no previous file with comments | « no previous file | device/serial/serial_io_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698