OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/base/gzip_filter.h" | 5 #include "net/base/gzip_filter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/base/gzip_header.h" | 8 #include "net/base/gzip_header.h" |
9 #include "third_party/zlib/zlib.h" | 9 #include "third_party/zlib/zlib.h" |
10 | 10 |
11 GZipFilter::GZipFilter() | 11 GZipFilter::GZipFilter(const FilterContext& filter_context) |
12 : decoding_status_(DECODING_UNINITIALIZED), | 12 : Filter(filter_context), |
| 13 decoding_status_(DECODING_UNINITIALIZED), |
13 decoding_mode_(DECODE_MODE_UNKNOWN), | 14 decoding_mode_(DECODE_MODE_UNKNOWN), |
14 gzip_header_status_(GZIP_CHECK_HEADER_IN_PROGRESS), | 15 gzip_header_status_(GZIP_CHECK_HEADER_IN_PROGRESS), |
15 zlib_header_added_(false), | 16 zlib_header_added_(false), |
16 gzip_footer_bytes_(0), | 17 gzip_footer_bytes_(0), |
17 possible_sdch_pass_through_(false) { | 18 possible_sdch_pass_through_(false) { |
18 } | 19 } |
19 | 20 |
20 GZipFilter::~GZipFilter() { | 21 GZipFilter::~GZipFilter() { |
21 if (decoding_status_ != DECODING_UNINITIALIZED) { | 22 if (decoding_status_ != DECODING_UNINITIALIZED) { |
22 MOZ_Z_inflateEnd(zlib_stream_.get()); | 23 MOZ_Z_inflateEnd(zlib_stream_.get()); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 int footer_byte_avail = std::min(footer_bytes_expected, stream_data_len_); | 285 int footer_byte_avail = std::min(footer_bytes_expected, stream_data_len_); |
285 stream_data_len_ -= footer_byte_avail; | 286 stream_data_len_ -= footer_byte_avail; |
286 next_stream_data_ += footer_byte_avail; | 287 next_stream_data_ += footer_byte_avail; |
287 gzip_footer_bytes_ += footer_byte_avail; | 288 gzip_footer_bytes_ += footer_byte_avail; |
288 | 289 |
289 if (stream_data_len_ == 0) | 290 if (stream_data_len_ == 0) |
290 next_stream_data_ = NULL; | 291 next_stream_data_ = NULL; |
291 } | 292 } |
292 } | 293 } |
293 | 294 |
OLD | NEW |