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/patch_writer_factory.h" 6 7 #include "bsdiff/endsley_patch_writer.h" 8 #include "bsdiff/patch_writer.h" 9 10 namespace bsdiff { 11 12 std::unique_ptr<PatchWriterInterface> CreateBsdiffPatchWriter( 13 const std::string& patch_filename) { 14 return std::unique_ptr<PatchWriterInterface>( 15 new BsdiffPatchWriter(patch_filename)); 16 } 17 18 std::unique_ptr<PatchWriterInterface> CreateBSDF2PatchWriter( 19 const std::string& patch_filename, 20 CompressorType type, 21 int brotli_quality) { 22 return CreateBSDF2PatchWriter( 23 patch_filename, std::vector<CompressorType>{type}, brotli_quality); 24 } 25 26 std::unique_ptr<PatchWriterInterface> CreateBSDF2PatchWriter( 27 const std::string& patch_filename, 28 const std::vector<CompressorType>& types, 29 int brotli_quality) { 30 return std::unique_ptr<PatchWriterInterface>( 31 new BsdiffPatchWriter(patch_filename, types, brotli_quality)); 32 } 33 34 std::unique_ptr<PatchWriterInterface> CreateEndsleyPatchWriter( 35 std::vector<uint8_t>* patch, 36 CompressorType type, 37 int brotli_quality) { 38 return std::unique_ptr<PatchWriterInterface>( 39 new EndsleyPatchWriter(patch, type, brotli_quality)); 40 } 41 42 std::unique_ptr<PatchWriterInterface> CreateEndsleyPatchWriter( 43 std::vector<uint8_t>* patch) { 44 return std::unique_ptr<PatchWriterInterface>( 45 new EndsleyPatchWriter(patch, CompressorType::kNoCompression, 0)); 46 } 47 48 } // namespace bsdiff 49