zucchini_apply.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2017 The Chromium 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. #ifndef COMPONENTS_ZUCCHINI_ZUCCHINI_APPLY_H_
  5. #define COMPONENTS_ZUCCHINI_ZUCCHINI_APPLY_H_
  6. #include "components/zucchini/image_utils.h"
  7. #include "components/zucchini/patch_reader.h"
  8. #include "components/zucchini/zucchini.h"
  9. namespace zucchini {
  10. // Reads equivalences from |patch_reader| to form preliminary |new_image|,
  11. // copying regions from |old_image| and writing extra data from |patch_reader|.
  12. bool ApplyEquivalenceAndExtraData(ConstBufferView old_image,
  13. const PatchElementReader& patch_reader,
  14. MutableBufferView new_image);
  15. // Reads raw delta from |patch_reader| and applies corrections to |new_image|.
  16. bool ApplyRawDelta(const PatchElementReader& patch_reader,
  17. MutableBufferView new_image);
  18. // Corrects references in |new_image| by projecting references from |old_image|
  19. // and applying corrections from |patch_reader|. Both |old_image| and
  20. // |new_image| are matching elements associated with |exe_type|.
  21. bool ApplyReferencesCorrection(ExecutableType exe_type,
  22. ConstBufferView old_image,
  23. const PatchElementReader& patch_reader,
  24. MutableBufferView new_image);
  25. // Applies patch element with type |exe_type| from |patch_reader| on |old_image|
  26. // to produce |new_image|.
  27. bool ApplyElement(ExecutableType exe_type,
  28. ConstBufferView old_image,
  29. const PatchElementReader& patch_reader,
  30. MutableBufferView new_image);
  31. } // namespace zucchini
  32. #endif // COMPONENTS_ZUCCHINI_ZUCCHINI_APPLY_H_