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, int32_t level = 6) |
|
Søren Gjesse
2014/01/15 10:38:43
Just use int64_t to avoid the static cast in filte
Ivan Posva
2014/01/16 05:05:41
That would be pushing the issue just downstream. T
| |
| 58 : gzip_(gzip), level_(level), current_buffer_(NULL) {} | 58 : gzip_(gzip), level_(level), current_buffer_(NULL) {} |
| 59 virtual ~ZLibDeflateFilter(); | 59 virtual ~ZLibDeflateFilter(); |
| 60 | 60 |
| 61 virtual bool Init(); | 61 virtual bool Init(); |
| 62 virtual bool Process(uint8_t* data, intptr_t length); | 62 virtual bool Process(uint8_t* data, intptr_t length); |
| 63 virtual intptr_t Processed(uint8_t* buffer, | 63 virtual intptr_t Processed(uint8_t* buffer, |
| 64 intptr_t length, | 64 intptr_t length, |
| 65 bool finish, | 65 bool finish, |
| 66 bool end); | 66 bool end); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 const bool gzip_; | 69 const bool gzip_; |
| 70 const int level_; | 70 const int32_t level_; |
| 71 uint8_t* current_buffer_; | 71 uint8_t* current_buffer_; |
| 72 z_stream stream_; | 72 z_stream stream_; |
| 73 | 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(ZLibDeflateFilter); | 74 DISALLOW_COPY_AND_ASSIGN(ZLibDeflateFilter); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 class ZLibInflateFilter : public Filter { | 77 class ZLibInflateFilter : public Filter { |
| 78 public: | 78 public: |
| 79 ZLibInflateFilter() : current_buffer_(NULL) {} | 79 ZLibInflateFilter() : current_buffer_(NULL) {} |
| 80 virtual ~ZLibInflateFilter(); | 80 virtual ~ZLibInflateFilter(); |
| 81 | 81 |
| 82 virtual bool Init(); | 82 virtual bool Init(); |
| 83 virtual bool Process(uint8_t* data, intptr_t length); | 83 virtual bool Process(uint8_t* data, intptr_t length); |
| 84 virtual intptr_t Processed(uint8_t* buffer, | 84 virtual intptr_t Processed(uint8_t* buffer, |
| 85 intptr_t length, | 85 intptr_t length, |
| 86 bool finish, | 86 bool finish, |
| 87 bool end); | 87 bool end); |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 uint8_t* current_buffer_; | 90 uint8_t* current_buffer_; |
| 91 z_stream stream_; | 91 z_stream stream_; |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(ZLibInflateFilter); | 93 DISALLOW_COPY_AND_ASSIGN(ZLibInflateFilter); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace bin | 96 } // namespace bin |
| 97 } // namespace dart | 97 } // namespace dart |
| 98 | 98 |
| 99 #endif // BIN_FILTER_H_ | 99 #endif // BIN_FILTER_H_ |
| OLD | NEW |