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

Side by Side Diff: device/serial/data_sink_receiver.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_sink_receiver.h ('k') | device/serial/data_source_sender.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_sink_receiver.h" 5 #include "device/serial/data_sink_receiver.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const CancelCallback& cancel_callback, 72 const CancelCallback& cancel_callback,
73 const ErrorCallback& error_callback) 73 const ErrorCallback& error_callback)
74 : binding_(this, request.Pass()), 74 : binding_(this, request.Pass()),
75 ready_callback_(ready_callback), 75 ready_callback_(ready_callback),
76 cancel_callback_(cancel_callback), 76 cancel_callback_(cancel_callback),
77 error_callback_(error_callback), 77 error_callback_(error_callback),
78 current_error_(0), 78 current_error_(0),
79 buffer_in_use_(NULL), 79 buffer_in_use_(NULL),
80 shut_down_(false), 80 shut_down_(false),
81 weak_factory_(this) { 81 weak_factory_(this) {
82 binding_.set_error_handler(this); 82 binding_.set_connection_error_handler(
83 base::Bind(&DataSinkReceiver::OnConnectionError, base::Unretained(this)));
83 } 84 }
84 85
85 void DataSinkReceiver::ShutDown() { 86 void DataSinkReceiver::ShutDown() {
86 shut_down_ = true; 87 shut_down_ = true;
87 } 88 }
88 89
89 DataSinkReceiver::~DataSinkReceiver() { 90 DataSinkReceiver::~DataSinkReceiver() {
90 } 91 }
91 92
92 void DataSinkReceiver::Cancel(int32_t error) { 93 void DataSinkReceiver::Cancel(int32_t error) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 callback_.Run(offset_, 0); 276 callback_.Run(offset_, 0);
276 } 277 }
277 void DataSinkReceiver::DataFrame::ReportError(uint32_t bytes_read, 278 void DataSinkReceiver::DataFrame::ReportError(uint32_t bytes_read,
278 int32_t error) { 279 int32_t error) {
279 offset_ += bytes_read; 280 offset_ += bytes_read;
280 DCHECK_LE(offset_, data_.size()); 281 DCHECK_LE(offset_, data_.size());
281 callback_.Run(offset_, error); 282 callback_.Run(offset_, error);
282 } 283 }
283 284
284 } // namespace device 285 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/data_sink_receiver.h ('k') | device/serial/data_source_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698