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.
7 [Client=DataSourceClient]
9 // Initializes this DataSource with the amount of data its client will
11 Init(uint32 buffer_size);
13 // Resumes sending data after it has been stopped due to an error.
16 // Reports that |bytes_sent| bytes have been successfully passed to the
18 ReportBytesReceived(uint32 bytes_sent);
21 interface DataSourceClient {
22 // Invoked to report |error| from the DataSource. No further bytes will be
23 // transmitted from the DataSource until Resume() is called.
26 // Invoked to transmit data from the DataSource.
27 OnData(array<uint8> data);
30 [Client=DataSinkClient]
32 // Initializes this DataSink with the amount of data it is expected to
34 Init(uint32 buffer_size);
36 // Requests the cancellation of any data that has been written to the pipe,
37 // but has not yet been sent to the sink.
40 // Invoked to pass |data| to the sink.
41 OnData(array<uint8> data);
44 interface DataSinkClient {
45 // Reports that the sink has successfully received |bytes_sent| bytes of data.
46 ReportBytesSent(uint32 bytes_sent);
48 // Reports that the sink has received |bytes_sent| bytes of data (possibly 0)
49 // and encountered an error: |error|. Any OnData messages received by the
50 // DataSink before the response will be discarded. The client should respond
51 // when it is ready to resume sending data.
52 ReportBytesSentAndError(uint32 bytes_sent, int32 error) => ();