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

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

Issue 1431723002: Add brotli content-encoding filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 // Filter performs filtering on data streams. Sample usage: 5 // Filter performs filtering on data streams. Sample usage:
6 // 6 //
7 // IStream* pre_filter_source; 7 // IStream* pre_filter_source;
8 // ... 8 // ...
9 // Filter* filter = Filter::Factory(filter_type, size); 9 // Filter* filter = Filter::Factory(filter_type, size);
10 // int pre_filter_data_len = filter->stream_buffer_size(); 10 // int pre_filter_data_len = filter->stream_buffer_size();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 FILTER_NEED_MORE_DATA, 144 FILTER_NEED_MORE_DATA,
145 // Read filtered data successfully, and filter reaches the end of the data 145 // Read filtered data successfully, and filter reaches the end of the data
146 // stream. 146 // stream.
147 FILTER_DONE, 147 FILTER_DONE,
148 // There is an error during filtering. 148 // There is an error during filtering.
149 FILTER_ERROR 149 FILTER_ERROR
150 }; 150 };
151 151
152 // Specifies type of filters that can be created. 152 // Specifies type of filters that can be created.
153 enum FilterType { 153 enum FilterType {
154 FILTER_TYPE_BROTLI,
154 FILTER_TYPE_DEFLATE, 155 FILTER_TYPE_DEFLATE,
155 FILTER_TYPE_GZIP, 156 FILTER_TYPE_GZIP,
156 FILTER_TYPE_GZIP_HELPING_SDCH, // Gzip possible, but pass through allowed. 157 FILTER_TYPE_GZIP_HELPING_SDCH, // Gzip possible, but pass through allowed.
157 FILTER_TYPE_SDCH, 158 FILTER_TYPE_SDCH,
158 FILTER_TYPE_SDCH_POSSIBLE, // Sdch possible, but pass through allowed. 159 FILTER_TYPE_SDCH_POSSIBLE, // Sdch possible, but pass through allowed.
159 FILTER_TYPE_UNSUPPORTED, 160 FILTER_TYPE_UNSUPPORTED,
160 }; 161 };
161 162
162 virtual ~Filter(); 163 virtual ~Filter();
163 164
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // encodings. These fixups require context, which includes whether this 225 // encodings. These fixups require context, which includes whether this
225 // response was made to an SDCH request (i.e., an available dictionary was 226 // response was made to an SDCH request (i.e., an available dictionary was
226 // advertised in the GET), as well as the mime type of the content. 227 // advertised in the GET), as well as the mime type of the content.
227 static void FixupEncodingTypes(const FilterContext& filter_context, 228 static void FixupEncodingTypes(const FilterContext& filter_context,
228 std::vector<FilterType>* encoding_types); 229 std::vector<FilterType>* encoding_types);
229 230
230 // Returns a string describing the FilterTypes implemented by this filter. 231 // Returns a string describing the FilterTypes implemented by this filter.
231 std::string OrderedFilterList() const; 232 std::string OrderedFilterList() const;
232 233
233 protected: 234 protected:
235 friend class BrotliFilter;
236 friend class BrotliUnitTest;
234 friend class GZipUnitTest; 237 friend class GZipUnitTest;
235 friend class SdchFilterChainingTest; 238 friend class SdchFilterChainingTest;
236 FRIEND_TEST_ALL_PREFIXES(FilterTest, ThreeFilterChain); 239 FRIEND_TEST_ALL_PREFIXES(FilterTest, ThreeFilterChain);
237 240
238 explicit Filter(FilterType type_id); 241 explicit Filter(FilterType type_id);
239 242
240 // Filters the data stored in stream_buffer_ and writes the output into the 243 // Filters the data stored in stream_buffer_ and writes the output into the
241 // dest_buffer passed in. 244 // dest_buffer passed in.
242 // 245 //
243 // Upon entry, *dest_len is the total size (in number of chars) of the 246 // Upon entry, *dest_len is the total size (in number of chars) of the
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 309
307 // The filter type this filter was constructed from. 310 // The filter type this filter was constructed from.
308 FilterType type_id_; 311 FilterType type_id_;
309 312
310 DISALLOW_COPY_AND_ASSIGN(Filter); 313 DISALLOW_COPY_AND_ASSIGN(Filter);
311 }; 314 };
312 315
313 } // namespace net 316 } // namespace net
314 317
315 #endif // NET_FILTER_FILTER_H__ 318 #endif // NET_FILTER_FILTER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698