| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/serial/serial_connection.h" | 5 #include "chrome/browser/extensions/api/serial/serial_connection.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 buffer_size_(kDefaultBufferSize), | 42 buffer_size_(kDefaultBufferSize), |
| 43 receive_timeout_(0), | 43 receive_timeout_(0), |
| 44 send_timeout_(0), | 44 send_timeout_(0), |
| 45 paused_(false), | 45 paused_(false), |
| 46 io_handler_(SerialIoHandler::Create()) { | 46 io_handler_(SerialIoHandler::Create()) { |
| 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 SerialConnection::~SerialConnection() { | 50 SerialConnection::~SerialConnection() { |
| 51 DCHECK(open_complete_.is_null()); | 51 DCHECK(open_complete_.is_null()); |
| 52 io_handler_->CancelRead(api::serial::RECEIVE_ERROR_CLOSED); | 52 io_handler_->CancelRead(api::serial::RECEIVE_ERROR_DISCONNECTED); |
| 53 io_handler_->CancelWrite(api::serial::SEND_ERROR_CLOSED); | 53 io_handler_->CancelWrite(api::serial::SEND_ERROR_DISCONNECTED); |
| 54 Close(); | 54 Close(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool SerialConnection::IsPersistent() const { | 57 bool SerialConnection::IsPersistent() const { |
| 58 return persistent(); | 58 return persistent(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void SerialConnection::set_buffer_size(int buffer_size) { | 61 void SerialConnection::set_buffer_size(int buffer_size) { |
| 62 buffer_size_ = buffer_size; | 62 buffer_size_ = buffer_size; |
| 63 } | 63 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 delay_); | 265 delay_); |
| 266 } | 266 } |
| 267 | 267 |
| 268 SerialConnection::TimeoutTask::~TimeoutTask() {} | 268 SerialConnection::TimeoutTask::~TimeoutTask() {} |
| 269 | 269 |
| 270 void SerialConnection::TimeoutTask::Run() const { | 270 void SerialConnection::TimeoutTask::Run() const { |
| 271 closure_.Run(); | 271 closure_.Run(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace extensions | 274 } // namespace extensions |
| OLD | NEW |