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

Side by Side Diff: device/serial/serial_connection.h

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 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/generic_sensor/sensor_provider_impl.cc ('k') | device/serial/serial_connection.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 #ifndef DEVICE_SERIAL_SERIAL_CONNECTION_H_ 5 #ifndef DEVICE_SERIAL_SERIAL_CONNECTION_H_
6 #define DEVICE_SERIAL_SERIAL_CONNECTION_H_ 6 #define DEVICE_SERIAL_SERIAL_CONNECTION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "device/serial/serial.mojom.h" 14 #include "device/serial/serial.mojom.h"
15 #include "mojo/public/cpp/bindings/strong_binding.h"
16 15
17 namespace device { 16 namespace device {
18 17
19 class DataSinkReceiver; 18 class DataSinkReceiver;
20 class DataSourceSender; 19 class DataSourceSender;
21 class ReadOnlyBuffer; 20 class ReadOnlyBuffer;
22 class SerialIoHandler; 21 class SerialIoHandler;
23 class WritableBuffer; 22 class WritableBuffer;
24 23
25 class SerialConnection : public serial::Connection { 24 class SerialConnection : public serial::Connection {
26 public: 25 public:
27 SerialConnection(scoped_refptr<SerialIoHandler> io_handler, 26 SerialConnection(scoped_refptr<SerialIoHandler> io_handler,
28 mojo::InterfaceRequest<serial::DataSink> sink, 27 mojo::InterfaceRequest<serial::DataSink> sink,
29 mojo::InterfaceRequest<serial::DataSource> source, 28 mojo::InterfaceRequest<serial::DataSource> source,
30 mojo::InterfacePtr<serial::DataSourceClient> source_client, 29 mojo::InterfacePtr<serial::DataSourceClient> source_client);
31 mojo::InterfaceRequest<serial::Connection> request);
32 ~SerialConnection() override; 30 ~SerialConnection() override;
33 31
34 // serial::Connection overrides. 32 // serial::Connection overrides.
35 void GetInfo(const GetInfoCallback& callback) override; 33 void GetInfo(const GetInfoCallback& callback) override;
36 void SetOptions(serial::ConnectionOptionsPtr options, 34 void SetOptions(serial::ConnectionOptionsPtr options,
37 const SetOptionsCallback& callback) override; 35 const SetOptionsCallback& callback) override;
38 void SetControlSignals(serial::HostControlSignalsPtr signals, 36 void SetControlSignals(serial::HostControlSignalsPtr signals,
39 const SetControlSignalsCallback& callback) override; 37 const SetControlSignalsCallback& callback) override;
40 void GetControlSignals(const GetControlSignalsCallback& callback) override; 38 void GetControlSignals(const GetControlSignalsCallback& callback) override;
41 void Flush(const FlushCallback& callback) override; 39 void Flush(const FlushCallback& callback) override;
42 40
43 private: 41 private:
44 void OnSendPipeReady(std::unique_ptr<ReadOnlyBuffer> buffer); 42 void OnSendPipeReady(std::unique_ptr<ReadOnlyBuffer> buffer);
45 void OnSendCancelled(int32_t error); 43 void OnSendCancelled(int32_t error);
46 void OnReceivePipeReady(std::unique_ptr<WritableBuffer> buffer); 44 void OnReceivePipeReady(std::unique_ptr<WritableBuffer> buffer);
47 45
48 scoped_refptr<SerialIoHandler> io_handler_; 46 scoped_refptr<SerialIoHandler> io_handler_;
49 scoped_refptr<DataSinkReceiver> receiver_; 47 scoped_refptr<DataSinkReceiver> receiver_;
50 scoped_refptr<DataSourceSender> sender_; 48 scoped_refptr<DataSourceSender> sender_;
51 49
52 mojo::StrongBinding<serial::Connection> binding_;
53
54 DISALLOW_COPY_AND_ASSIGN(SerialConnection); 50 DISALLOW_COPY_AND_ASSIGN(SerialConnection);
55 }; 51 };
56 52
57 } // namespace device 53 } // namespace device
58 54
59 #endif // DEVICE_SERIAL_SERIAL_CONNECTION_H_ 55 #endif // DEVICE_SERIAL_SERIAL_CONNECTION_H_
OLDNEW
« no previous file with comments | « device/generic_sensor/sensor_provider_impl.cc ('k') | device/serial/serial_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698