1*a3a45f30SXin Li // Copyright 2017 The Chromium OS Authors. All rights reserved. 2*a3a45f30SXin Li // Use of this source code is governed by a BSD-style license that can be 3*a3a45f30SXin Li // found in the LICENSE file. 4*a3a45f30SXin Li 5*a3a45f30SXin Li #ifndef _BSDIFF_BROTLI_DECOMPRESSOR_H_ 6*a3a45f30SXin Li #define _BSDIFF_BROTLI_DECOMPRESSOR_H_ 7*a3a45f30SXin Li 8*a3a45f30SXin Li #include <brotli/decode.h> 9*a3a45f30SXin Li 10*a3a45f30SXin Li #include "bsdiff/decompressor_interface.h" 11*a3a45f30SXin Li 12*a3a45f30SXin Li namespace bsdiff { 13*a3a45f30SXin Li 14*a3a45f30SXin Li class BrotliDecompressor : public DecompressorInterface { 15*a3a45f30SXin Li public: BrotliDecompressor()16*a3a45f30SXin Li BrotliDecompressor() 17*a3a45f30SXin Li : brotli_decoder_state_(nullptr), next_in_(nullptr), available_in_(0) {} 18*a3a45f30SXin Li ~BrotliDecompressor(); 19*a3a45f30SXin Li 20*a3a45f30SXin Li // DecompressorInterface overrides. 21*a3a45f30SXin Li bool SetInputData(const uint8_t* input_data, size_t size) override; 22*a3a45f30SXin Li bool Read(uint8_t* output_data, size_t bytes_to_output) override; 23*a3a45f30SXin Li bool Close() override; 24*a3a45f30SXin Li 25*a3a45f30SXin Li private: 26*a3a45f30SXin Li BrotliDecoderState* brotli_decoder_state_; 27*a3a45f30SXin Li const uint8_t* next_in_; 28*a3a45f30SXin Li size_t available_in_; 29*a3a45f30SXin Li }; 30*a3a45f30SXin Li 31*a3a45f30SXin Li } // namespace bsdiff 32*a3a45f30SXin Li 33*a3a45f30SXin Li #endif // _BSDIFF_BROTLI_DECOMPRESSOR_H_ 34