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 "extensions/browser/api/serial/serial_connection.h" | 5 #include "extensions/browser/api/serial/serial_connection.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 buffer_size_(kDefaultBufferSize), | 162 buffer_size_(kDefaultBufferSize), |
163 receive_timeout_(0), | 163 receive_timeout_(0), |
164 send_timeout_(0), | 164 send_timeout_(0), |
165 paused_(false), | 165 paused_(false), |
166 io_handler_(device::SerialIoHandler::Create( | 166 io_handler_(device::SerialIoHandler::Create( |
167 content::BrowserThread::GetMessageLoopProxyForThread( | 167 content::BrowserThread::GetMessageLoopProxyForThread( |
168 content::BrowserThread::FILE), | 168 content::BrowserThread::FILE), |
169 content::BrowserThread::GetMessageLoopProxyForThread( | 169 content::BrowserThread::GetMessageLoopProxyForThread( |
170 content::BrowserThread::UI))) { | 170 content::BrowserThread::UI))) { |
171 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 171 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
172 io_handler_->set_port(port); | |
Reilly Grant (use Gerrit)
2015/11/11 20:43:59
Why not set port_ in Open?
juncai
2015/11/12 05:27:08
Done.
| |
172 } | 173 } |
173 | 174 |
174 SerialConnection::~SerialConnection() { | 175 SerialConnection::~SerialConnection() { |
175 io_handler_->CancelRead(device::serial::RECEIVE_ERROR_DISCONNECTED); | 176 io_handler_->CancelRead(device::serial::RECEIVE_ERROR_DISCONNECTED); |
176 io_handler_->CancelWrite(device::serial::SEND_ERROR_DISCONNECTED); | 177 io_handler_->CancelWrite(device::serial::SEND_ERROR_DISCONNECTED); |
177 } | 178 } |
178 | 179 |
179 bool SerialConnection::IsPersistent() const { | 180 bool SerialConnection::IsPersistent() const { |
180 return persistent(); | 181 return persistent(); |
181 } | 182 } |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
411 output->parity_bit = extensions::ConvertParityBitToMojo(input.parity_bit); | 412 output->parity_bit = extensions::ConvertParityBitToMojo(input.parity_bit); |
412 output->stop_bits = extensions::ConvertStopBitsToMojo(input.stop_bits); | 413 output->stop_bits = extensions::ConvertStopBitsToMojo(input.stop_bits); |
413 if (input.cts_flow_control.get()) { | 414 if (input.cts_flow_control.get()) { |
414 output->has_cts_flow_control = true; | 415 output->has_cts_flow_control = true; |
415 output->cts_flow_control = *input.cts_flow_control; | 416 output->cts_flow_control = *input.cts_flow_control; |
416 } | 417 } |
417 return output.Pass(); | 418 return output.Pass(); |
418 } | 419 } |
419 | 420 |
420 } // namespace mojo | 421 } // namespace mojo |
OLD | NEW |