| Index: content/browser/download/byte_stream.h
|
| diff --git a/content/browser/download/byte_stream.h b/content/browser/download/byte_stream.h
|
| index 8265b8dd20e241885ceba8918e0bbfa745d6a4f0..f5be75aeed86f0f8f5591e860bfd6e1fb9652bc7 100644
|
| --- a/content/browser/download/byte_stream.h
|
| +++ b/content/browser/download/byte_stream.h
|
| @@ -26,15 +26,15 @@ namespace content {
|
| // sink, which may be on different threads. It is intended to be the
|
| // only connection between source and sink; they need have no
|
| // direct awareness of each other aside from the byte stream. The source and
|
| -// the sink have different interfaces to a byte stream, |ByteStreamInput|
|
| -// and |ByteStreamOutput|. A pair of connected interfaces is generated by
|
| +// the sink have different interfaces to a byte stream, |ByteStreamWriter|
|
| +// and |ByteStreamReader|. A pair of connected interfaces is generated by
|
| // calling |CreateByteStream|.
|
| //
|
| -// The source adds bytes to the bytestream via |ByteStreamInput::Write|
|
| -// and the sink retrieves bytes already written via |ByteStreamOutput::Read|.
|
| +// The source adds bytes to the bytestream via |ByteStreamWriter::Write|
|
| +// and the sink retrieves bytes already written via |ByteStreamReader::Read|.
|
| //
|
| // When the source has no more data to add, it will call
|
| -// |ByteStreamInput::Close| to indicate that. Errors at the source
|
| +// |ByteStreamWriter::Close| to indicate that. Errors at the source
|
| // are indicated to the sink via a non-DOWNLOAD_INTERRUPT_REASON_NONE code.
|
| //
|
| // Normally the source is not managed after the relationship is setup;
|
| @@ -58,9 +58,9 @@ namespace content {
|
| //
|
| // Class methods are virtual to allow mocking for tests; these classes
|
| // aren't intended to be base classes for other classes.
|
| -class CONTENT_EXPORT ByteStreamInput {
|
| +class CONTENT_EXPORT ByteStreamWriter {
|
| public:
|
| - virtual ~ByteStreamInput() = 0;
|
| + virtual ~ByteStreamWriter() = 0;
|
|
|
| // Always adds the data passed into the ByteStream. Returns true
|
| // if more data may be added without exceeding the class limit
|
| @@ -75,21 +75,22 @@ public:
|
|
|
| // Register a callback to be called when the stream transitions from
|
| // full to having space available. The callback will always be
|
| - // called on the task runner associated with the ByteStreamInput.
|
| + // called on the task runner associated with the ByteStreamWriter.
|
| // This callback will only be called if a call to Write has previously
|
| // returned false (i.e. the ByteStream has been filled).
|
| // Multiple calls to this function are supported, though note that it
|
| // is the callers responsibility to handle races with space becoming
|
| // available (i.e. in the case of that race either of the before
|
| // or after callbacks may be called).
|
| + // The callback will not be called after ByteStreamWriter destruction.
|
| virtual void RegisterCallback(const base::Closure& source_callback) = 0;
|
| };
|
|
|
| -class CONTENT_EXPORT ByteStreamOutput {
|
| +class CONTENT_EXPORT ByteStreamReader {
|
| public:
|
| enum StreamState { STREAM_EMPTY, STREAM_HAS_DATA, STREAM_COMPLETE };
|
|
|
| - virtual ~ByteStreamOutput() = 0;
|
| + virtual ~ByteStreamReader() = 0;
|
|
|
| // Returns STREAM_EMPTY if there is no data on the ByteStream and
|
| // Close() has not been called, and STREAM_COMPLETE if there
|
| @@ -109,6 +110,7 @@ class CONTENT_EXPORT ByteStreamOutput {
|
| // though note that it is the callers responsibility to handle races
|
| // with data becoming available (i.e. in the case of that race
|
| // either of the before or after callbacks may be called).
|
| + // The callback will not be called after ByteStreamReader destruction.
|
| virtual void RegisterCallback(const base::Closure& sink_callback) = 0;
|
| };
|
|
|
| @@ -116,8 +118,8 @@ CONTENT_EXPORT void CreateByteStream(
|
| scoped_refptr<base::SequencedTaskRunner> input_task_runner,
|
| scoped_refptr<base::SequencedTaskRunner> output_task_runner,
|
| size_t buffer_size,
|
| - scoped_ptr<ByteStreamInput>* input,
|
| - scoped_ptr<ByteStreamOutput>* output);
|
| + scoped_ptr<ByteStreamWriter>* input,
|
| + scoped_ptr<ByteStreamReader>* output);
|
|
|
| } // namespace content
|
|
|
|
|