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
3 // found in the LICENSE file.
8 // Initializes this DataSource with the amount of data its client will
10 Init(uint32 buffer_size);
12 // Resumes sending data after it has been stopped due to an error.
15 // Reports that |bytes_sent| bytes have been successfully passed to the
17 ReportBytesReceived(uint32 bytes_sent);
20 interface DataSourceClient {
21 // Invoked to report |error| from the DataSource. No further bytes will be
22 // transmitted from the DataSource until Resume() is called.
25 // Invoked to transmit data from the DataSource.
26 OnData(array<uint8> data);
30 // Requests the cancellation of any data that has been written to the pipe,
31 // but has not yet been sent to the sink.
34 // Invoked to pass |data| to the sink. The response contains the number of
35 // bytes successfully sent and an optional error. If |error| is zero,
36 // |bytes_sent| will the size of |data|.
37 OnData(array<uint8> data) => (uint32 bytes_sent, int32 error);
39 // Called to clear the error and resume data transmission after an error
40 // occurs. After an error is reported in response to an OnData until
41 // ClearError is called, any further OnData calls will report the same error
42 // as the first error response.