| 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_SENDER_H_ | 5 #ifndef DEVICE_SERIAL_DATA_SENDER_H_ |
| 6 #define DEVICE_SERIAL_DATA_SENDER_H_ | 6 #define DEVICE_SERIAL_DATA_SENDER_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/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 13 #include "device/serial/buffer.h" | 13 #include "device/serial/buffer.h" |
| 14 #include "device/serial/data_stream.mojom.h" | 14 #include "device/serial/data_stream.mojom.h" |
| 15 #include "mojo/public/cpp/system/data_pipe.h" | 15 #include "third_party/mojo/src/mojo/public/cpp/system/data_pipe.h" |
| 16 | 16 |
| 17 namespace device { | 17 namespace device { |
| 18 | 18 |
| 19 // A DataSender sends data to a DataSink. | 19 // A DataSender sends data to a DataSink. |
| 20 class DataSender : public serial::DataSinkClient, public mojo::ErrorHandler { | 20 class DataSender : public serial::DataSinkClient, public mojo::ErrorHandler { |
| 21 public: | 21 public: |
| 22 typedef base::Callback<void(uint32_t bytes_sent)> DataSentCallback; | 22 typedef base::Callback<void(uint32_t bytes_sent)> DataSentCallback; |
| 23 typedef base::Callback<void(uint32_t bytes_sent, int32_t error)> | 23 typedef base::Callback<void(uint32_t bytes_sent, int32_t error)> |
| 24 SendErrorCallback; | 24 SendErrorCallback; |
| 25 typedef base::Callback<void()> CancelCallback; | 25 typedef base::Callback<void()> CancelCallback; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 // Whether we have encountered a fatal error and shut down. | 94 // Whether we have encountered a fatal error and shut down. |
| 95 bool shut_down_; | 95 bool shut_down_; |
| 96 | 96 |
| 97 DISALLOW_COPY_AND_ASSIGN(DataSender); | 97 DISALLOW_COPY_AND_ASSIGN(DataSender); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 } // namespace device | 100 } // namespace device |
| 101 | 101 |
| 102 #endif // DEVICE_SERIAL_DATA_SENDER_H_ | 102 #endif // DEVICE_SERIAL_DATA_SENDER_H_ |
| OLD | NEW |