Chromium Code Reviews| Index: net/base/filter.h |
| diff --git a/net/base/filter.h b/net/base/filter.h |
| index c6004e9d754385c96e419dd5fffc9d76947e68bb..b8788b8a2886a6a5b45cdb22475a947b0a23fae9 100644 |
| --- a/net/base/filter.h |
| +++ b/net/base/filter.h |
| @@ -38,13 +38,10 @@ |
| #include "base/ref_counted.h" |
| #include "base/scoped_ptr.h" |
| #include "base/time.h" |
| +#include "net/base/io_buffer.h" |
| class GURL; |
| -namespace net { |
| -class IOBuffer; |
| -} |
| - |
| //------------------------------------------------------------------------------ |
| // Define an interface class that allows access to contextual information |
| // supplied by the owner of this filter. In the case where there are a chain of |
| @@ -94,13 +91,6 @@ class FilterContext { |
| // For example: 200 is ok. 4xx are error codes. etc. |
| virtual int GetResponseCode() const = 0; |
| - // What is the desirable input buffer size for these filters? |
| - // This value is currently supplied by the context, and is constant for all |
| - // filters, even when they are part of a chain of filters. (i.e., we currently |
| - // don't change the input buffer sizes for a linked chain of filters, and the |
| - // buffer size for input to all filters in a chain is this one constant). |
| - virtual int GetInputStreamBufferSize() const = 0; |
| - |
| // The following method forces the context to emit a specific set of |
| // statistics as selected by the argument. |
| virtual void RecordPacketStats(StatisticSelector statistic) const = 0; |
| @@ -184,6 +174,15 @@ class Filter { |
| // The function returns true if success, and false otherwise. |
| bool FlushStreamBuffer(int stream_data_len); |
| +#if defined(UNIT_TEST) |
| + // Resets the filter's internal buffer to the given size. Should only |
| + // be called in unit tests, and only immediately after filter construction. |
| + void ResetInputBufferForTest(int size) { |
|
jar (doing other things)
2011/02/15 06:48:53
This strikes me as a bad or perilous interface for
jar (doing other things)
2011/02/25 18:37:24
I spoke with others on the Chrome team about this
adamk
2011/02/25 20:48:13
I'm happy to get rid of the UNIT_TEST nonsense and
jar (doing other things)
2011/02/26 01:36:52
Perhaps I chose the wrong words....
I was trying
|
| + stream_buffer_ = new net::IOBuffer(size); |
| + stream_buffer_size_ = size; |
| + } |
| +#endif |
| + |
| // Translate the text of a filter name (from Content-Encoding header) into a |
| // FilterType. |
| static FilterType ConvertEncodingToType(const std::string& filter_type); |
| @@ -245,11 +244,6 @@ class Filter { |
| const FilterContext& filter_context, |
| Filter* filter_list); |
| - // Allocates and initializes stream_buffer_ based on filter_context_. |
| - // Establishes a buffer large enough to handle the amount specified in |
| - // filter_context_.GetInputStreamBufferSize(). |
| - bool InitBuffer(); |
| - |
| // Helper function to empty our output into the next filter's input. |
| void PushDataIntoNextFilter(); |