Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: net/filter/filter_source_stream.h

Issue 2331193005: Add EOF signal in FilterSourceStream::FilterData() (Closed)
Patch Set: self review Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/filter/filter_source_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 NET_FILTER_FILTER_SOURCE_STREAM_H_ 5 #ifndef NET_FILTER_FILTER_SOURCE_STREAM_H_
6 #define NET_FILTER_FILTER_SOURCE_STREAM_H_ 6 #define NET_FILTER_FILTER_SOURCE_STREAM_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 // Subclasses should implement this method to filter data from 63 // Subclasses should implement this method to filter data from
64 // |input_buffer| and write to |output_buffer|. 64 // |input_buffer| and write to |output_buffer|.
65 // This method must complete synchronously (i.e. It cannot return 65 // This method must complete synchronously (i.e. It cannot return
66 // ERR_IO_PENDING). If an unrecoverable error occurred, this should return 66 // ERR_IO_PENDING). If an unrecoverable error occurred, this should return
67 // ERR_CONTENT_DECODING_FAILED or a more specific error code. 67 // ERR_CONTENT_DECODING_FAILED or a more specific error code.
68 // 68 //
69 // FilterData() will be repeatedly invoked with the same |input_buffer| until 69 // FilterData() will be repeatedly invoked with the same |input_buffer| until
70 // FilterData() returns 0 or an error. If FilterData() returns 0, 70 // FilterData() returns 0 or an error. If FilterData() returns 0,
71 // |input_buffer| must be fully drained. Upstream EOF is reached when 71 // |input_buffer| must be fully drained. Upstream EOF is reached when
72 // FilterData() is called with |input_buffer->BytesRemaining() == 0|. 72 // FilterData() is called with |upstream_eof_reached| = true.
73 // TODO(xunjieli): consider allowing asynchronous response via callback 73 // TODO(xunjieli): consider allowing asynchronous response via callback
74 // to support off-thread decompression. 74 // to support off-thread decompression.
75 virtual int FilterData(IOBuffer* output_buffer, 75 virtual int FilterData(IOBuffer* output_buffer,
76 int output_buffer_size, 76 int output_buffer_size,
77 DrainableIOBuffer* input_buffer) = 0; 77 DrainableIOBuffer* input_buffer,
78 bool upstream_eof_reached) = 0;
78 79
79 // Returns a string representation of the type of this FilterSourceStream. 80 // Returns a string representation of the type of this FilterSourceStream.
80 // This is for UMA logging. 81 // This is for UMA logging.
81 virtual std::string GetTypeAsString() const = 0; 82 virtual std::string GetTypeAsString() const = 0;
82 83
83 // Returns whether |this| still needs more input data from |upstream_|. 84 // Returns whether |this| still needs more input data from |upstream_|.
84 // By default, |this| will continue reading until |upstream_| returns an error 85 // By default, |this| will continue reading until |upstream_| returns an error
85 // or EOF. Subclass can override this to return false to skip reading all the 86 // or EOF. Subclass can override this to return false to skip reading all the
86 // input from |upstream_|. 87 // input from |upstream_|.
87 virtual bool NeedMoreData() const; 88 virtual bool NeedMoreData() const;
(...skipping 20 matching lines...) Expand all
108 109
109 // Reading from |upstream_| has returned 0 byte or an error code. 110 // Reading from |upstream_| has returned 0 byte or an error code.
110 bool upstream_end_reached_; 111 bool upstream_end_reached_;
111 112
112 DISALLOW_COPY_AND_ASSIGN(FilterSourceStream); 113 DISALLOW_COPY_AND_ASSIGN(FilterSourceStream);
113 }; 114 };
114 115
115 } // namespace net 116 } // namespace net
116 117
117 #endif // NET_FILTER_FILTER_SOURCE_STREAM_H_ 118 #endif // NET_FILTER_FILTER_SOURCE_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | net/filter/filter_source_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698