summaryrefslogtreecommitdiffstats
path: root/device/serial/serial_connection.h
diff options
context:
space:
mode:
authorsammc <sammc@chromium.org>2014-08-26 23:41:34 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-27 06:43:14 +0000
commitd96dc3e6fe8023ee49e9facbc42cc600ee127a34 (patch)
treee297c3c9d3b93dc140e014c66c92468d6576099b /device/serial/serial_connection.h
parent3f0a6c825a02f72c9bde6d2f074010d090590b7a (diff)
downloadchromium_src-d96dc3e6fe8023ee49e9facbc42cc600ee127a34.zip
chromium_src-d96dc3e6fe8023ee49e9facbc42cc600ee127a34.tar.gz
chromium_src-d96dc3e6fe8023ee49e9facbc42cc600ee127a34.tar.bz2
Implement the host side of serial connection I/O on data pipe.
This change adds DataSource and DataSink interface request parameters to SerialService::Connect, passes them through to SerialConnection instances via SerialConnectionFactory; the SerialConnection now uses a DataSourceSender and a DataSinkReceiver for implementing serial receive and send, respectively. BUG=389016 Review URL: https://codereview.chromium.org/488363002 Cr-Commit-Position: refs/heads/master@{#292104}
Diffstat (limited to 'device/serial/serial_connection.h')
-rw-r--r--device/serial/serial_connection.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/device/serial/serial_connection.h b/device/serial/serial_connection.h
index 31d5fc3..807e173 100644
--- a/device/serial/serial_connection.h
+++ b/device/serial/serial_connection.h
@@ -6,16 +6,23 @@
#define DEVICE_SERIAL_SERIAL_CONNECTION_H_
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "device/serial/serial.mojom.h"
#include "mojo/public/cpp/bindings/interface_impl.h"
namespace device {
+class DataSinkReceiver;
+class DataSourceSender;
+class ReadOnlyBuffer;
class SerialIoHandler;
+class WritableBuffer;
class SerialConnection : public mojo::InterfaceImpl<serial::Connection> {
public:
- explicit SerialConnection(scoped_refptr<SerialIoHandler> io_handler);
+ SerialConnection(scoped_refptr<SerialIoHandler> io_handler,
+ mojo::InterfaceRequest<serial::DataSink> sink,
+ mojo::InterfaceRequest<serial::DataSource> source);
virtual ~SerialConnection();
// mojo::InterfaceImpl<serial::Connection> overrides.
@@ -31,7 +38,13 @@ class SerialConnection : public mojo::InterfaceImpl<serial::Connection> {
virtual void Flush(const mojo::Callback<void(bool)>& callback) OVERRIDE;
private:
+ void OnSendPipeReady(scoped_ptr<ReadOnlyBuffer> buffer);
+ void OnSendCancelled(int32_t error);
+ void OnReceivePipeReady(scoped_ptr<WritableBuffer> buffer);
+
scoped_refptr<SerialIoHandler> io_handler_;
+ scoped_refptr<DataSinkReceiver> receiver_;
+ scoped_refptr<DataSourceSender> sender_;
DISALLOW_COPY_AND_ASSIGN(SerialConnection);
};