Home | History | Annotate | Download | only in bsdiff
      1 // Copyright 2017 The Chromium OS Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "bsdiff/decompressor_interface.h"
      6 
      7 #include "bsdiff/brotli_decompressor.h"
      8 #include "bsdiff/bz2_decompressor.h"
      9 #include "bsdiff/logging.h"
     10 
     11 namespace bsdiff {
     12 
     13 std::unique_ptr<DecompressorInterface> CreateDecompressor(CompressorType type) {
     14   switch (type) {
     15     case CompressorType::kBZ2:
     16       return std::unique_ptr<DecompressorInterface>(new BZ2Decompressor());
     17     case CompressorType::kBrotli:
     18       return std::unique_ptr<DecompressorInterface>(new BrotliDecompressor());
     19     default:
     20       LOG(ERROR) << "unsupported compressor type: "
     21                  << static_cast<uint8_t>(type);
     22       return nullptr;
     23   }
     24 }
     25 
     26 }  // namespace bsdiff
     27