OLD | NEW |
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_DATA_SINK_RECEIVER_H_ | 5 #ifndef DEVICE_SERIAL_DATA_SINK_RECEIVER_H_ |
6 #define DEVICE_SERIAL_DATA_SINK_RECEIVER_H_ | 6 #define DEVICE_SERIAL_DATA_SINK_RECEIVER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // |cancel_callback| and |error_callback| will never be called. | 45 // |cancel_callback| and |error_callback| will never be called. |
46 void ShutDown(); | 46 void ShutDown(); |
47 | 47 |
48 private: | 48 private: |
49 class Buffer; | 49 class Buffer; |
50 class DataFrame; | 50 class DataFrame; |
51 friend class base::RefCounted<DataSinkReceiver>; | 51 friend class base::RefCounted<DataSinkReceiver>; |
52 | 52 |
53 ~DataSinkReceiver() override; | 53 ~DataSinkReceiver() override; |
54 | 54 |
55 // mojo::InterfaceImpl<serial::DataSink> overrides. | 55 // serial::DataSink overrides. |
56 void Cancel(int32_t error) override; | 56 void Cancel(int32_t error) override; |
57 void OnData(mojo::Array<uint8_t> data, | 57 void OnData(mojo::Array<uint8_t> data, |
58 const mojo::Callback<void(uint32_t, int32_t)>& callback) override; | 58 const OnDataCallback& callback) override; |
59 void ClearError() override; | 59 void ClearError() override; |
60 | 60 |
61 void OnConnectionError(); | 61 void OnConnectionError(); |
62 | 62 |
63 // Dispatches data to |ready_callback_|. | 63 // Dispatches data to |ready_callback_|. |
64 void RunReadyCallback(); | 64 void RunReadyCallback(); |
65 | 65 |
66 // Reports a successful read of |bytes_read|. | 66 // Reports a successful read of |bytes_read|. |
67 void Done(uint32_t bytes_read); | 67 void Done(uint32_t bytes_read); |
68 | 68 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool shut_down_; | 105 bool shut_down_; |
106 | 106 |
107 base::WeakPtrFactory<DataSinkReceiver> weak_factory_; | 107 base::WeakPtrFactory<DataSinkReceiver> weak_factory_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(DataSinkReceiver); | 109 DISALLOW_COPY_AND_ASSIGN(DataSinkReceiver); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace device | 112 } // namespace device |
113 | 113 |
114 #endif // DEVICE_SERIAL_DATA_SINK_RECEIVER_H_ | 114 #endif // DEVICE_SERIAL_DATA_SINK_RECEIVER_H_ |
OLD | NEW |