| 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 // BZip2Filter applies bzip2 content encoding/decoding to a datastream. | 5 // BZip2Filter applies bzip2 content encoding/decoding to a datastream. |
| 6 // Since it is a new feature, and no specification said what 's bzip2 content | 6 // Since it is a new feature, and no specification said what 's bzip2 content |
| 7 // composed of in http protocol. So I assume with bzip2 encoding the content | 7 // composed of in http protocol. So I assume with bzip2 encoding the content |
| 8 // is full format, which means the content should carry complete bzip2 head, | 8 // is full format, which means the content should carry complete bzip2 head, |
| 9 // such as inlcude magic number 1(BZh), block size bit, magic number 2(0x31, | 9 // such as inlcude magic number 1(BZh), block size bit, magic number 2(0x31, |
| 10 // 0x41, 0x59, 0x26, 0xx53, 0x59) | 10 // 0x41, 0x59, 0x26, 0xx53, 0x59) |
| 11 // Maybe need to inserts a bzlib2 header to the data stream before calling | 11 // Maybe need to inserts a bzlib2 header to the data stream before calling |
| 12 // decompression functionality, but at now I do not meet this sort of real | 12 // decompression functionality, but at now I do not meet this sort of real |
| 13 // scenarios. So let's see the further requests. | 13 // scenarios. So let's see the further requests. |
| 14 // | 14 // |
| 15 // This BZip2Filter internally uses third_party/bzip2 library to do decoding. | 15 // This BZip2Filter internally uses third_party/bzip2 library to do decoding. |
| 16 // | 16 // |
| 17 // BZip2Filter is also a subclass of Filter. See the latter's header file filter
.h | 17 // BZip2Filter is also a subclass of Filter. See the latter's header file |
| 18 // for sample usage. | 18 // filter.h for sample usage. |
| 19 | 19 |
| 20 #ifndef NET_BASE_BZIP2_FILTER_H_ | 20 #ifndef NET_BASE_BZIP2_FILTER_H_ |
| 21 #define NET_BASE_BZIP2_FILTER_H_ | 21 #define NET_BASE_BZIP2_FILTER_H_ |
| 22 | 22 |
| 23 #include "base/scoped_ptr.h" | 23 #include "base/scoped_ptr.h" |
| 24 #include "net/base/filter.h" | 24 #include "net/base/filter.h" |
| 25 #include "third_party/bzip2/bzlib.h" | 25 #include "third_party/bzip2/bzlib.h" |
| 26 | 26 |
| 27 class BZip2Filter : public Filter { | 27 class BZip2Filter : public Filter { |
| 28 public: | 28 public: |
| 29 BZip2Filter(); | 29 explicit BZip2Filter(const FilterContext& filter_context); |
| 30 | 30 |
| 31 virtual ~BZip2Filter(); | 31 virtual ~BZip2Filter(); |
| 32 | 32 |
| 33 // Initializes filter decoding mode and internal control blocks. | 33 // Initializes filter decoding mode and internal control blocks. |
| 34 // Parameter use_small_memory specifies whether use small memory | 34 // Parameter use_small_memory specifies whether use small memory |
| 35 // to decompresss data. If small is nonzero, the bzip2 library will | 35 // to decompresss data. If small is nonzero, the bzip2 library will |
| 36 // use an alternative decompression algorithm which uses less memory | 36 // use an alternative decompression algorithm which uses less memory |
| 37 // but at the cost of decompressing more slowly (roughly speaking, | 37 // but at the cost of decompressing more slowly (roughly speaking, |
| 38 // half the speed, but the maximum memory requirement drops to | 38 // half the speed, but the maximum memory requirement drops to |
| 39 // around 2300k). For more information, see doc in http://www.bzip.org. | 39 // around 2300k). For more information, see doc in http://www.bzip.org. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // The control block of bzip which actually does the decoding. | 75 // The control block of bzip which actually does the decoding. |
| 76 // This data structure is initialized by InitDecoding and updated in | 76 // This data structure is initialized by InitDecoding and updated in |
| 77 // ReadFilteredData. | 77 // ReadFilteredData. |
| 78 scoped_ptr<bz_stream> bzip2_data_stream_; | 78 scoped_ptr<bz_stream> bzip2_data_stream_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(BZip2Filter); | 80 DISALLOW_COPY_AND_ASSIGN(BZip2Filter); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 #endif // NET_BASE_BZIP2_FILTER_H_ | 83 #endif // NET_BASE_BZIP2_FILTER_H_ |
| 84 | 84 |
| OLD | NEW |