| 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_RECEIVER_H_ | 5 #ifndef DEVICE_SERIAL_DATA_RECEIVER_H_ |
| 6 #define DEVICE_SERIAL_DATA_RECEIVER_H_ | 6 #define DEVICE_SERIAL_DATA_RECEIVER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "device/serial/buffer.h" | 14 #include "device/serial/buffer.h" |
| 15 #include "device/serial/data_stream.mojom.h" | 15 #include "device/serial/data_stream.mojom.h" |
| 16 #include "mojo/public/cpp/system/data_pipe.h" | 16 #include "third_party/mojo/src/mojo/public/cpp/system/data_pipe.h" |
| 17 | 17 |
| 18 namespace device { | 18 namespace device { |
| 19 | 19 |
| 20 // A DataReceiver receives data from a DataSource. | 20 // A DataReceiver receives data from a DataSource. |
| 21 class DataReceiver : public base::RefCounted<DataReceiver>, | 21 class DataReceiver : public base::RefCounted<DataReceiver>, |
| 22 public serial::DataSourceClient, | 22 public serial::DataSourceClient, |
| 23 public mojo::ErrorHandler { | 23 public mojo::ErrorHandler { |
| 24 public: | 24 public: |
| 25 typedef base::Callback<void(scoped_ptr<ReadOnlyBuffer>)> ReceiveDataCallback; | 25 typedef base::Callback<void(scoped_ptr<ReadOnlyBuffer>)> ReceiveDataCallback; |
| 26 typedef base::Callback<void(int32_t error)> ReceiveErrorCallback; | 26 typedef base::Callback<void(int32_t error)> ReceiveErrorCallback; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 std::queue<linked_ptr<DataFrame>> pending_data_frames_; | 87 std::queue<linked_ptr<DataFrame>> pending_data_frames_; |
| 88 | 88 |
| 89 base::WeakPtrFactory<DataReceiver> weak_factory_; | 89 base::WeakPtrFactory<DataReceiver> weak_factory_; |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(DataReceiver); | 91 DISALLOW_COPY_AND_ASSIGN(DataReceiver); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 } // namespace device | 94 } // namespace device |
| 95 | 95 |
| 96 #endif // DEVICE_SERIAL_DATA_RECEIVER_H_ | 96 #endif // DEVICE_SERIAL_DATA_RECEIVER_H_ |
| OLD | NEW |