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

Unified Diff: device/serial/serial_connection.cc

Issue 2410743002: Remove the mojo serial interfaces and related infrastructure. (Closed)
Patch Set: Created 4 years, 2 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/serial_connection.h ('k') | device/serial/serial_connection_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/serial/serial_connection.cc
diff --git a/device/serial/serial_connection.cc b/device/serial/serial_connection.cc
deleted file mode 100644
index ccf0e176f9d88a350a6c3de14b638c555a320c20..0000000000000000000000000000000000000000
--- a/device/serial/serial_connection.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "device/serial/serial_connection.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "device/serial/buffer.h"
-#include "device/serial/data_sink_receiver.h"
-#include "device/serial/data_source_sender.h"
-#include "device/serial/serial_io_handler.h"
-
-namespace device {
-
-SerialConnection::SerialConnection(
- scoped_refptr<SerialIoHandler> io_handler,
- mojo::InterfaceRequest<serial::DataSink> sink,
- mojo::InterfaceRequest<serial::DataSource> source,
- mojo::InterfacePtr<serial::DataSourceClient> source_client)
- : io_handler_(io_handler) {
- receiver_ = new DataSinkReceiver(
- std::move(sink),
- base::Bind(&SerialConnection::OnSendPipeReady, base::Unretained(this)),
- base::Bind(&SerialConnection::OnSendCancelled, base::Unretained(this)),
- base::Bind(base::DoNothing));
- sender_ = new DataSourceSender(
- std::move(source), std::move(source_client),
- base::Bind(&SerialConnection::OnReceivePipeReady, base::Unretained(this)),
- base::Bind(base::DoNothing));
-}
-
-SerialConnection::~SerialConnection() {
- receiver_->ShutDown();
- sender_->ShutDown();
- io_handler_->CancelRead(serial::ReceiveError::DISCONNECTED);
- io_handler_->CancelWrite(serial::SendError::DISCONNECTED);
-}
-
-void SerialConnection::GetInfo(const GetInfoCallback& callback) {
- callback.Run(io_handler_->GetPortInfo());
-}
-
-void SerialConnection::SetOptions(serial::ConnectionOptionsPtr options,
- const SetOptionsCallback& callback) {
- callback.Run(io_handler_->ConfigurePort(*options));
- io_handler_->CancelRead(device::serial::ReceiveError::NONE);
-}
-
-void SerialConnection::SetControlSignals(
- serial::HostControlSignalsPtr signals,
- const SetControlSignalsCallback& callback) {
- callback.Run(io_handler_->SetControlSignals(*signals));
-}
-
-void SerialConnection::GetControlSignals(
- const GetControlSignalsCallback& callback) {
- callback.Run(io_handler_->GetControlSignals());
-}
-
-void SerialConnection::Flush(const FlushCallback& callback) {
- callback.Run(io_handler_->Flush());
-}
-
-void SerialConnection::OnSendCancelled(int32_t error) {
- io_handler_->CancelWrite(static_cast<serial::SendError>(error));
-}
-
-void SerialConnection::OnSendPipeReady(std::unique_ptr<ReadOnlyBuffer> buffer) {
- io_handler_->Write(std::move(buffer));
-}
-
-void SerialConnection::OnReceivePipeReady(
- std::unique_ptr<WritableBuffer> buffer) {
- io_handler_->Read(std::move(buffer));
-}
-
-} // namespace device
« no previous file with comments | « device/serial/serial_connection.h ('k') | device/serial/serial_connection_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698