| 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/data_source_sender.h" | 5 #include "device/serial/data_source_sender.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 base::Bind(&DataSourceSender::OnConnectionError, base::Unretained(this))); | 93 base::Bind(&DataSourceSender::OnConnectionError, base::Unretained(this))); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void DataSourceSender::ShutDown() { | 96 void DataSourceSender::ShutDown() { |
| 97 shut_down_ = true; | 97 shut_down_ = true; |
| 98 ready_callback_.Reset(); | 98 ready_callback_.Reset(); |
| 99 error_callback_.Reset(); | 99 error_callback_.Reset(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 DataSourceSender::~DataSourceSender() { | 102 DataSourceSender::~DataSourceSender() { |
| 103 DCHECK(shut_down_); | |
| 104 } | 103 } |
| 105 | 104 |
| 106 void DataSourceSender::Init(uint32_t buffer_size) { | 105 void DataSourceSender::Init(uint32_t buffer_size) { |
| 107 available_buffer_capacity_ = buffer_size; | 106 available_buffer_capacity_ = buffer_size; |
| 108 GetMoreData(); | 107 GetMoreData(); |
| 109 } | 108 } |
| 110 | 109 |
| 111 void DataSourceSender::Resume() { | 110 void DataSourceSender::Resume() { |
| 112 if (pending_send_) { | 111 if (pending_send_) { |
| 113 DispatchFatalError(); | 112 DispatchFatalError(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 uint32_t bytes_written, | 243 uint32_t bytes_written, |
| 245 int32_t error) { | 244 int32_t error) { |
| 246 DCHECK(sender_.get()); | 245 DCHECK(sender_.get()); |
| 247 PendingSend* send = pending_send_; | 246 PendingSend* send = pending_send_; |
| 248 pending_send_ = nullptr; | 247 pending_send_ = nullptr; |
| 249 send->DoneWithError(bytes_written, error); | 248 send->DoneWithError(bytes_written, error); |
| 250 sender_ = nullptr; | 249 sender_ = nullptr; |
| 251 } | 250 } |
| 252 | 251 |
| 253 } // namespace device | 252 } // namespace device |
| OLD | NEW |