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

Unified Diff: device/serial/data_source_sender.cc

Issue 889283002: Remove Client= from device/serial/data_stream.mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: This time without racing message pipes Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/serial/data_source_sender.h ('k') | device/serial/data_source_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/serial/data_source_sender.cc
diff --git a/device/serial/data_source_sender.cc b/device/serial/data_source_sender.cc
index f9cc4f1bd2c393fd24c94af085a146a643393efd..97029dda656e490603edea3c7d9b73161157bf4c 100644
--- a/device/serial/data_source_sender.cc
+++ b/device/serial/data_source_sender.cc
@@ -71,15 +71,22 @@ class DataSourceSender::PendingSend::Buffer : public WritableBuffer {
uint32_t buffer_size_;
};
-DataSourceSender::DataSourceSender(const ReadyCallback& ready_callback,
- const ErrorCallback& error_callback)
- : ready_callback_(ready_callback),
+DataSourceSender::DataSourceSender(
+ mojo::InterfaceRequest<serial::DataSource> source,
+ mojo::InterfacePtr<serial::DataSourceClient> client,
+ const ReadyCallback& ready_callback,
+ const ErrorCallback& error_callback)
+ : binding_(this, source.Pass()),
+ client_(client.Pass()),
+ ready_callback_(ready_callback),
error_callback_(error_callback),
available_buffer_capacity_(0),
paused_(false),
shut_down_(false),
weak_factory_(this) {
DCHECK(!ready_callback.is_null() && !error_callback.is_null());
+ binding_.set_error_handler(this);
+ client_.set_error_handler(this);
}
void DataSourceSender::ShutDown() {
@@ -138,7 +145,7 @@ void DataSourceSender::DoneWithError(const std::vector<char>& data,
int32_t error) {
DoneInternal(data);
if (!shut_down_)
- client()->OnError(error);
+ client_->OnError(error);
paused_ = true;
// We don't call GetMoreData here so we don't send any additional data until
// Resume() is called.
@@ -153,7 +160,7 @@ void DataSourceSender::DoneInternal(const std::vector<char>& data) {
if (!data.empty()) {
mojo::Array<uint8_t> data_to_send(data.size());
std::copy(data.begin(), data.end(), &data_to_send[0]);
- client()->OnData(data_to_send.Pass());
+ client_->OnData(data_to_send.Pass());
}
pending_send_.reset();
}
« no previous file with comments | « device/serial/data_source_sender.h ('k') | device/serial/data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698