| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef REMOTING_BASE_DECOMPRESSOR_H_ | 5 #ifndef REMOTING_BASE_DECOMPRESSOR_H_ |
| 6 #define REMOTING_BASE_DECOMPRESSOR_H_ | 6 #define REMOTING_BASE_DECOMPRESSOR_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 namespace remoting { | 10 namespace remoting { |
| 11 | 11 |
| 12 // An object to decompress data losslessly. This is used in pair with | 12 // An object to decompress data losslessly. This is used in pair with |
| 13 // a compressor. | 13 // a compressor. |
| 14 // | 14 // |
| 15 // Note that a decompressor can only be used on one stream during its | 15 // Note that a decompressor can only be used on one stream during its |
| 16 // lifetime. This object should be destroyed after use. | 16 // lifetime. This object should be destroyed after use. |
| 17 class Decompressor { | 17 class Decompressor { |
| 18 public: | 18 public: |
| 19 virtual ~Decompressor() {} | 19 virtual ~Decompressor() {} |
| 20 | 20 |
| 21 // Resets all the internal state so the decompressor behaves as if it was |
| 22 // just created. |
| 23 virtual void Reset() = 0; |
| 24 |
| 21 // Decompress |input_data| with |input_size| bytes. | 25 // Decompress |input_data| with |input_size| bytes. |
| 22 // | 26 // |
| 23 // |output_data| is provided by the caller and |output_size| is the | 27 // |output_data| is provided by the caller and |output_size| is the |
| 24 // size of |output_data|. |output_size| must be greater than 0. | 28 // size of |output_data|. |output_size| must be greater than 0. |
| 25 // | 29 // |
| 26 // Decompressed data is written to |output_data|. |consumed| will | 30 // Decompressed data is written to |output_data|. |consumed| will |
| 27 // contain the number of bytes consumed from the input. |written| | 31 // contain the number of bytes consumed from the input. |written| |
| 28 // contains the number of bytes written to output. | 32 // contains the number of bytes written to output. |
| 29 // | 33 // |
| 30 // Returns true if this method needs to be called again because | 34 // Returns true if this method needs to be called again because |
| 31 // there is more bytes to be decompressed or more input data is | 35 // there is more bytes to be decompressed or more input data is |
| 32 // needed. | 36 // needed. |
| 33 virtual bool Process(const uint8* input_data, int input_size, | 37 virtual bool Process(const uint8* input_data, int input_size, |
| 34 uint8* output_data, int output_size, | 38 uint8* output_data, int output_size, |
| 35 int* consumed, int* written) = 0; | 39 int* consumed, int* written) = 0; |
| 36 }; | 40 }; |
| 37 | 41 |
| 38 } // namespace remoting | 42 } // namespace remoting |
| 39 | 43 |
| 40 #endif // REMOTING_BASE_DECOMPRESSOR_H_ | 44 #endif // REMOTING_BASE_DECOMPRESSOR_H_ |
| OLD | NEW |