aboutsummaryrefslogtreecommitdiff
path: root/zucchini_integration.h
diff options
context:
space:
mode:
authorSamuel Huang <huangs@chromium.org>2018-03-21 18:54:03 +0000
committerEdward Lesmes <ehmaldonado@google.com>2021-07-23 21:58:36 +0000
commit1bb3b651b14c9cec5cf0104a1dec1550b9c22983 (patch)
tree6c50b80ae3ef0e87d09a70a233e9c37f3e0ff4e1 /zucchini_integration.h
parent6d057299c73d1c69ddd3084eb7cd1d25d8c70002 (diff)
downloadzucchini-1bb3b651b14c9cec5cf0104a1dec1550b9c22983.tar.gz
[Zucchini] Add "-keep" flag; remove redundnat CRC32 check.
By defaulti, Zucchini deletes the output (patch or patched "new") file upon failure. The "-keep" debug flag overrides this behavior, so the bad output file can be examined. This CL adds the flag for Zucchini-gen and Zucchini-apply. This CL also removes a duplicated call to Ensemble::CheckOldFile(), which checks the CRC32 of the "old" file. This removal prevents redundant work and slightly speed up Zucchini-apply (by ~5%). Bug: 729154 Change-Id: I9ba8e9b00b7783661de06b39fae010761bedc6e6 Reviewed-on: https://chromium-review.googlesource.com/973746 Reviewed-by: agrieve <agrieve@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#544786} NOKEYCHECK=True GitOrigin-RevId: 21879c3adbfbbf676e5ee28b9f0a19e60d104d80
Diffstat (limited to 'zucchini_integration.h')
-rw-r--r--zucchini_integration.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/zucchini_integration.h b/zucchini_integration.h
index 7c3fc40..ce98b28 100644
--- a/zucchini_integration.h
+++ b/zucchini_integration.h
@@ -13,21 +13,24 @@ namespace zucchini {
// Applies the patch in |patch_file| to the bytes in |old_file| and writes the
// result to |new_file|. Since this uses memory mapped files, crashes are
-// expected in case of I/O errors. On Windows |new_file| is kept iff returned
-// code is kStatusSuccess, and is deleted otherwise. For UNIX systems the
-// caller needs to do cleanup since it has ownership of the base::File params
-// and Zucchini has no knowledge of which base::FilePath to delete.
+// expected in case of I/O errors. On Windows, |new_file| is kept iff returned
+// code is kStatusSuccess or if |force_keep == true|, and is deleted otherwise.
+// For UNIX systems the caller needs to do cleanup since it has ownership of the
+// base::File params and Zucchini has no knowledge of which base::FilePath to
+// delete.
status::Code Apply(base::File&& old_file,
base::File&& patch_file,
- base::File&& new_file);
+ base::File&& new_file,
+ bool force_keep = false);
// Applies the patch in |patch_path| to the bytes in |old_path| and writes the
// result to |new_path|. Since this uses memory mapped files, crashes are
// expected in case of I/O errors. |new_path| is kept iff returned code is
-// kStatusSuccess, and is deleted otherwise.
+// kStatusSuccess or if |force_keep == true|, and is deleted otherwise.
status::Code Apply(const base::FilePath& old_path,
const base::FilePath& patch_path,
- const base::FilePath& new_path);
+ const base::FilePath& new_path,
+ bool force_keep = false);
} // namespace zucchini