OLD | NEW |
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 #include "net/filter/gzip_filter.h" | 5 #include "net/filter/gzip_filter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/filter/gzip_header.h" | 8 #include "net/filter/gzip_header.h" |
9 #include "third_party/zlib/zlib.h" | 9 #include "third_party/zlib/zlib.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 GZipFilter::GZipFilter() | 13 GZipFilter::GZipFilter(FilterType type) |
14 : decoding_status_(DECODING_UNINITIALIZED), | 14 : Filter(type), |
| 15 decoding_status_(DECODING_UNINITIALIZED), |
15 decoding_mode_(DECODE_MODE_UNKNOWN), | 16 decoding_mode_(DECODE_MODE_UNKNOWN), |
16 gzip_header_status_(GZIP_CHECK_HEADER_IN_PROGRESS), | 17 gzip_header_status_(GZIP_CHECK_HEADER_IN_PROGRESS), |
17 zlib_header_added_(false), | 18 zlib_header_added_(false), |
18 gzip_footer_bytes_(0), | 19 gzip_footer_bytes_(0), |
19 possible_sdch_pass_through_(false) { | 20 possible_sdch_pass_through_(false) { |
20 } | 21 } |
21 | 22 |
22 GZipFilter::~GZipFilter() { | 23 GZipFilter::~GZipFilter() { |
23 if (decoding_status_ != DECODING_UNINITIALIZED) { | 24 if (decoding_status_ != DECODING_UNINITIALIZED) { |
24 inflateEnd(zlib_stream_.get()); | 25 inflateEnd(zlib_stream_.get()); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 stream_data_len_ -= footer_byte_avail; | 290 stream_data_len_ -= footer_byte_avail; |
290 next_stream_data_ += footer_byte_avail; | 291 next_stream_data_ += footer_byte_avail; |
291 gzip_footer_bytes_ += footer_byte_avail; | 292 gzip_footer_bytes_ += footer_byte_avail; |
292 | 293 |
293 if (stream_data_len_ == 0) | 294 if (stream_data_len_ == 0) |
294 next_stream_data_ = NULL; | 295 next_stream_data_ = NULL; |
295 } | 296 } |
296 } | 297 } |
297 | 298 |
298 } // namespace net | 299 } // namespace net |
OLD | NEW |