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

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

Issue 1212023004: Convert all usages of mojo::ErrorHandler in //device/serial to callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « device/serial/data_source_sender.h ('k') | device/serial/serial_connection_unittest.cc » ('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 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const ErrorCallback& error_callback) 78 const ErrorCallback& error_callback)
79 : binding_(this, source.Pass()), 79 : binding_(this, source.Pass()),
80 client_(client.Pass()), 80 client_(client.Pass()),
81 ready_callback_(ready_callback), 81 ready_callback_(ready_callback),
82 error_callback_(error_callback), 82 error_callback_(error_callback),
83 available_buffer_capacity_(0), 83 available_buffer_capacity_(0),
84 paused_(false), 84 paused_(false),
85 shut_down_(false), 85 shut_down_(false),
86 weak_factory_(this) { 86 weak_factory_(this) {
87 DCHECK(!ready_callback.is_null() && !error_callback.is_null()); 87 DCHECK(!ready_callback.is_null() && !error_callback.is_null());
88 binding_.set_error_handler(this); 88 binding_.set_connection_error_handler(
89 client_.set_error_handler(this); 89 base::Bind(&DataSourceSender::OnConnectionError, base::Unretained(this)));
90 client_.set_connection_error_handler(
91 base::Bind(&DataSourceSender::OnConnectionError, base::Unretained(this)));
90 } 92 }
91 93
92 void DataSourceSender::ShutDown() { 94 void DataSourceSender::ShutDown() {
93 shut_down_ = true; 95 shut_down_ = true;
94 ready_callback_.Reset(); 96 ready_callback_.Reset();
95 error_callback_.Reset(); 97 error_callback_.Reset();
96 } 98 }
97 99
98 DataSourceSender::~DataSourceSender() { 100 DataSourceSender::~DataSourceSender() {
99 DCHECK(shut_down_); 101 DCHECK(shut_down_);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 uint32_t bytes_written, 242 uint32_t bytes_written,
241 int32_t error) { 243 int32_t error) {
242 DCHECK(sender_.get()); 244 DCHECK(sender_.get());
243 PendingSend* send = pending_send_; 245 PendingSend* send = pending_send_;
244 pending_send_ = nullptr; 246 pending_send_ = nullptr;
245 send->DoneWithError(bytes_written, error); 247 send->DoneWithError(bytes_written, error);
246 sender_ = nullptr; 248 sender_ = nullptr;
247 } 249 }
248 250
249 } // namespace device 251 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/data_source_sender.h ('k') | device/serial/serial_connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698