Chromium Code Reviews| 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 private: | 47 private: |
| 48 static const intptr_t kFilterBufferSize = 64 * KB; | 48 static const intptr_t kFilterBufferSize = 64 * KB; |
| 49 uint8_t processed_buffer_[kFilterBufferSize]; | 49 uint8_t processed_buffer_[kFilterBufferSize]; |
| 50 bool initialized_; | 50 bool initialized_; |
| 51 | 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(Filter); | 52 DISALLOW_COPY_AND_ASSIGN(Filter); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 class ZLibDeflateFilter : public Filter { | 55 class ZLibDeflateFilter : public Filter { |
| 56 public: | 56 public: |
| 57 ZLibDeflateFilter(bool gzip = false, int level = 6) | 57 ZLibDeflateFilter(bool gzip = false, int level = 6, int windowBits = 15, |
|
Anders Johnsen
2014/01/15 10:52:08
Do the arguments need a default value here (and be
vicb
2014/01/15 11:08:04
Nope, you're right, will update
vicb
2014/01/23 09:14:04
fixed
| |
| 58 : gzip_(gzip), level_(level), current_buffer_(NULL) {} | 58 bool raw = false, int memLevel = 8) : |
| 59 gzip_(gzip), level_(level), windowBits_(windowBits), raw_(raw), | |
| 60 memLevel_(memLevel), current_buffer_(NULL) | |
| 61 {} | |
| 59 virtual ~ZLibDeflateFilter(); | 62 virtual ~ZLibDeflateFilter(); |
| 60 | 63 |
| 61 virtual bool Init(); | 64 virtual bool Init(); |
| 62 virtual bool Process(uint8_t* data, intptr_t length); | 65 virtual bool Process(uint8_t* data, intptr_t length); |
| 63 virtual intptr_t Processed(uint8_t* buffer, | 66 virtual intptr_t Processed(uint8_t* buffer, |
| 64 intptr_t length, | 67 intptr_t length, |
| 65 bool finish, | 68 bool finish, |
| 66 bool end); | 69 bool end); |
| 67 | 70 |
| 68 private: | 71 private: |
| 69 const bool gzip_; | 72 const bool gzip_; |
| 70 const int level_; | 73 const int level_; |
| 74 const int windowBits_; | |
| 75 const bool raw_; | |
| 76 const int memLevel_; | |
| 71 uint8_t* current_buffer_; | 77 uint8_t* current_buffer_; |
| 72 z_stream stream_; | 78 z_stream stream_; |
| 73 | 79 |
| 74 DISALLOW_COPY_AND_ASSIGN(ZLibDeflateFilter); | 80 DISALLOW_COPY_AND_ASSIGN(ZLibDeflateFilter); |
| 75 }; | 81 }; |
| 76 | 82 |
| 77 class ZLibInflateFilter : public Filter { | 83 class ZLibInflateFilter : public Filter { |
| 78 public: | 84 public: |
| 79 ZLibInflateFilter() : current_buffer_(NULL) {} | 85 ZLibInflateFilter(int windowBits = 15, bool raw = false) : |
|
Anders Johnsen
2014/01/15 10:52:08
Move : to next line.
vicb
2014/01/23 09:14:04
no more relevant
| |
| 86 windowBits_(windowBits), raw_(raw), current_buffer_(NULL) | |
| 87 {} | |
| 80 virtual ~ZLibInflateFilter(); | 88 virtual ~ZLibInflateFilter(); |
| 81 | 89 |
| 82 virtual bool Init(); | 90 virtual bool Init(); |
| 83 virtual bool Process(uint8_t* data, intptr_t length); | 91 virtual bool Process(uint8_t* data, intptr_t length); |
| 84 virtual intptr_t Processed(uint8_t* buffer, | 92 virtual intptr_t Processed(uint8_t* buffer, |
| 85 intptr_t length, | 93 intptr_t length, |
| 86 bool finish, | 94 bool finish, |
| 87 bool end); | 95 bool end); |
| 88 | 96 |
| 89 private: | 97 private: |
| 98 const int windowBits_; | |
| 99 const bool raw_; | |
| 90 uint8_t* current_buffer_; | 100 uint8_t* current_buffer_; |
| 91 z_stream stream_; | 101 z_stream stream_; |
| 92 | 102 |
| 93 DISALLOW_COPY_AND_ASSIGN(ZLibInflateFilter); | 103 DISALLOW_COPY_AND_ASSIGN(ZLibInflateFilter); |
| 94 }; | 104 }; |
| 95 | 105 |
| 96 } // namespace bin | 106 } // namespace bin |
| 97 } // namespace dart | 107 } // namespace dart |
| 98 | 108 |
| 99 #endif // BIN_FILTER_H_ | 109 #endif // BIN_FILTER_H_ |
| OLD | NEW |