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

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

Issue 2338043002: Change DrainableIOBuffer to IBuffer and int* in FilterData() arguments (Closed)
Patch Set: rebased to r418859 and add DCHECKs 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 // Helper method used as a callback argument passed to |upstream_->Read()|. 60 // Helper method used as a callback argument passed to |upstream_->Read()|.
61 void OnIOComplete(int result); 61 void OnIOComplete(int result);
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 // If FilterData() returns 0, *|consumed_bytes| must be equal to
70 // FilterData() returns 0 or an error. If FilterData() returns 0, 70 // |input_buffer_size|. Upstream EOF is reached when FilterData() is called
71 // |input_buffer| must be fully drained. Upstream EOF is reached when 71 // with |upstream_eof_reached| = true.
72 // FilterData() is called with |upstream_eof_reached| = true.
73 // TODO(xunjieli): consider allowing asynchronous response via callback 72 // TODO(xunjieli): consider allowing asynchronous response via callback
74 // to support off-thread decompression. 73 // to support off-thread decompression.
75 virtual int FilterData(IOBuffer* output_buffer, 74 virtual int FilterData(IOBuffer* output_buffer,
76 int output_buffer_size, 75 int output_buffer_size,
77 DrainableIOBuffer* input_buffer, 76 IOBuffer* input_buffer,
77 int input_buffer_size,
78 int* consumed_bytes,
78 bool upstream_eof_reached) = 0; 79 bool upstream_eof_reached) = 0;
79 80
80 // Returns a string representation of the type of this FilterSourceStream. 81 // Returns a string representation of the type of this FilterSourceStream.
81 // This is for UMA logging. 82 // This is for UMA logging.
82 virtual std::string GetTypeAsString() const = 0; 83 virtual std::string GetTypeAsString() const = 0;
83 84
84 // Returns whether |this| still needs more input data from |upstream_|. 85 // Returns whether |this| still needs more input data from |upstream_|.
85 // By default, |this| will continue reading until |upstream_| returns an error 86 // By default, |this| will continue reading until |upstream_| returns an error
86 // or EOF. Subclass can override this to return false to skip reading all the 87 // or EOF. Subclass can override this to return false to skip reading all the
87 // input from |upstream_|. 88 // input from |upstream_|.
(...skipping 21 matching lines...) Expand all
109 110
110 // Reading from |upstream_| has returned 0 byte or an error code. 111 // Reading from |upstream_| has returned 0 byte or an error code.
111 bool upstream_end_reached_; 112 bool upstream_end_reached_;
112 113
113 DISALLOW_COPY_AND_ASSIGN(FilterSourceStream); 114 DISALLOW_COPY_AND_ASSIGN(FilterSourceStream);
114 }; 115 };
115 116
116 } // namespace net 117 } // namespace net
117 118
118 #endif // NET_FILTER_FILTER_SOURCE_STREAM_H_ 119 #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