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

Side by Side Diff: device/serial/data_source_sender.cc

Issue 1925463002: Mojo: Make device/ to not rely on connecton error notification on message loop destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | device/usb/mojo/device_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | device/usb/mojo/device_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698