| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BIN_FILTER_H_ | 5 #ifndef BIN_FILTER_H_ |
| 6 #define BIN_FILTER_H_ | 6 #define BIN_FILTER_H_ |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 uint8_t processed_buffer_[kFilterBufferSize]; | 47 uint8_t processed_buffer_[kFilterBufferSize]; |
| 48 bool initialized_; | 48 bool initialized_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(Filter); | 50 DISALLOW_COPY_AND_ASSIGN(Filter); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class ZLibDeflateFilter : public Filter { | 53 class ZLibDeflateFilter : public Filter { |
| 54 public: | 54 public: |
| 55 ZLibDeflateFilter(bool gzip, int32_t level, int32_t window_bits, | 55 ZLibDeflateFilter(bool gzip, int32_t level, int32_t window_bits, |
| 56 int32_t mem_level, int32_t strategy, | 56 int32_t mem_level, int32_t strategy, |
| 57 uint8_t* dictionary, bool raw) | 57 uint8_t* dictionary, intptr_t dictionary_length, bool raw) |
| 58 : gzip_(gzip), level_(level), window_bits_(window_bits), | 58 : gzip_(gzip), level_(level), window_bits_(window_bits), |
| 59 mem_level_(mem_level), strategy_(strategy), dictionary_(dictionary), | 59 mem_level_(mem_level), strategy_(strategy), dictionary_(dictionary), |
| 60 raw_(raw), current_buffer_(NULL) | 60 dictionary_length_(dictionary_length), raw_(raw), current_buffer_(NULL) |
| 61 {} | 61 {} |
| 62 virtual ~ZLibDeflateFilter(); | 62 virtual ~ZLibDeflateFilter(); |
| 63 | 63 |
| 64 virtual bool Init(); | 64 virtual bool Init(); |
| 65 virtual bool Process(uint8_t* data, intptr_t length); | 65 virtual bool Process(uint8_t* data, intptr_t length); |
| 66 virtual intptr_t Processed(uint8_t* buffer, intptr_t length, bool finish, | 66 virtual intptr_t Processed(uint8_t* buffer, intptr_t length, bool finish, |
| 67 bool end); | 67 bool end); |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 const bool gzip_; | 70 const bool gzip_; |
| 71 const int32_t level_; | 71 const int32_t level_; |
| 72 const int32_t window_bits_; | 72 const int32_t window_bits_; |
| 73 const int32_t mem_level_; | 73 const int32_t mem_level_; |
| 74 const int32_t strategy_; | 74 const int32_t strategy_; |
| 75 uint8_t* dictionary_; | 75 uint8_t* dictionary_; |
| 76 const intptr_t dictionary_length_; |
| 76 const bool raw_; | 77 const bool raw_; |
| 77 uint8_t* current_buffer_; | 78 uint8_t* current_buffer_; |
| 78 z_stream stream_; | 79 z_stream stream_; |
| 79 | 80 |
| 80 DISALLOW_COPY_AND_ASSIGN(ZLibDeflateFilter); | 81 DISALLOW_COPY_AND_ASSIGN(ZLibDeflateFilter); |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 class ZLibInflateFilter : public Filter { | 84 class ZLibInflateFilter : public Filter { |
| 84 public: | 85 public: |
| 85 ZLibInflateFilter(int32_t window_bits, uint8_t* dictionary, bool raw) | 86 ZLibInflateFilter(int32_t window_bits, uint8_t* dictionary, |
| 86 : window_bits_(window_bits), dictionary_(dictionary), raw_(raw), | 87 intptr_t dictionary_length, bool raw) |
| 87 current_buffer_(NULL) | 88 : window_bits_(window_bits), dictionary_(dictionary), |
| 89 dictionary_length_(dictionary_length), raw_(raw), current_buffer_(NULL) |
| 88 {} | 90 {} |
| 89 virtual ~ZLibInflateFilter(); | 91 virtual ~ZLibInflateFilter(); |
| 90 | 92 |
| 91 virtual bool Init(); | 93 virtual bool Init(); |
| 92 virtual bool Process(uint8_t* data, intptr_t length); | 94 virtual bool Process(uint8_t* data, intptr_t length); |
| 93 virtual intptr_t Processed(uint8_t* buffer, intptr_t length, bool finish, | 95 virtual intptr_t Processed(uint8_t* buffer, intptr_t length, bool finish, |
| 94 bool end); | 96 bool end); |
| 95 | 97 |
| 96 private: | 98 private: |
| 97 const int32_t window_bits_; | 99 const int32_t window_bits_; |
| 98 uint8_t* dictionary_; | 100 uint8_t* dictionary_; |
| 101 const intptr_t dictionary_length_; |
| 99 const bool raw_; | 102 const bool raw_; |
| 100 uint8_t* current_buffer_; | 103 uint8_t* current_buffer_; |
| 101 z_stream stream_; | 104 z_stream stream_; |
| 102 | 105 |
| 103 DISALLOW_COPY_AND_ASSIGN(ZLibInflateFilter); | 106 DISALLOW_COPY_AND_ASSIGN(ZLibInflateFilter); |
| 104 }; | 107 }; |
| 105 | 108 |
| 106 } // namespace bin | 109 } // namespace bin |
| 107 } // namespace dart | 110 } // namespace dart |
| 108 | 111 |
| 109 #endif // BIN_FILTER_H_ | 112 #endif // BIN_FILTER_H_ |
| OLD | NEW |