aboutsummaryrefslogtreecommitdiff
path: root/main_utils.cc
AgeCommit message (Collapse)Author
2021-07-25Refactor OS_LINUX preprocessor directive for LaCrOS effort.Sean McAllister
Currently, ChromeOS defines the OS_LINUX directive as well as OS_CHROMEOS. We're working to separate these two, so we're making the fact that OS_LINUX == OS_LINUX || OS_CHROMEOS explicit. Bug: 1110266 Change-Id: I88dc82e3b48bd1d63189d3e57ed0f3fe3351279b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352024 Commit-Queue: Sean McAllister <smcallis@google.com> Reviewed-by: Jonathan Backer <backer@chromium.org> Reviewed-by: Carlos IL <carlosil@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#799690} NOKEYCHECK=True GitOrigin-RevId: 74bfcb4cd5469b0b9a4b265a6c5d9f92051ed973
2021-07-25//components: Convert base::(U)Int(64)ToString(16) to NumberToString(16)Raul Tambre
The former non-overloaded variants are deprecated. Removed casts where they are now unnecessary. This is a mechanical change; there is no intended behavior change. Change-Id: Idc852a0940c2e104a3b38c7419d29f5df5b05125 Reviewed-on: https://chromium-review.googlesource.com/c/1454631 Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> Reviewed-by: Marc Treib <treib@chromium.org> Commit-Queue: Marc Treib <treib@chromium.org> Cr-Commit-Position: refs/heads/master@{#629523} NOKEYCHECK=True GitOrigin-RevId: f88e5108fc018e680a449f876bddc2bded9fb122
2021-07-25[Zucchini] Refactor Zucchini-gen in zucchini_io layer.Samuel Huang
This CL moves Zucchini-gen invocation code from zucchini_commands.cc (in target zucchini) to zucchini_integration.cc (in target zucchini_io) to clean up layering in Zucchini API, i.e.: - zucchini_lib: Operates on buffers only. - zucchini_io: Adds files interface, uses memory-mapped I/O. - zucchini: Stand-alone executable that parses command-line arguments. Other changes: - Rename zucchini_lib functions (zuchcini.h), to dedup names and emphasize that these functions operate on buffers: - GenerateEnsemble() -> GenerateBuffer(), - GenerateEnsembleWithImposedMatches() -> GenerateBufferImposed(), - GenerateRaw() -> GenerateBufferRaw(), - Apply() -> ApplyBuffer(). These renames only affect Zucchini and various tests. - Variable renames and parameter reordering in zucchini_integration.cc. - Remove '-dd' param in help text of Zucchini-detect (was never ported from Trunk, and has been recently deleted there as well). - Replace all base::File&& with base::File. - Miscellaneous cleanup for header include. - Update README.md. Change-Id: I835b80d4d3d7b291fa822a7a89dab225bf9171e9 Reviewed-on: https://chromium-review.googlesource.com/1105625 Reviewed-by: Samuel Huang <huangs@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#569274} NOKEYCHECK=True GitOrigin-RevId: 9f0f325d6e2595deb8d50c77e0464946f3bf1ec1
2021-07-23[Zucchini] Introduce Imposed Ensemble Matcher.Samuel Huang
Previously Zucchini-gen uses built-in heuristics to perform element matching for ensemble patch generation. This CL adds an option (accessible via the -impose parameter) to specify elements in "old" and "new", and how they match. This allows the default heuristics to be overridden, and enables external applications (who perhaps have better ideas of element matching, e.g., have access to archiving programs) to better use Zucchini to patch archives. Zucchini-match is updated to prints the -impose command line to repeat its results. Also, ElementMatch::ToString() is added. Change-Id: I541b64722904c2fcd19ed75246d87e0268fbf86c Reviewed-on: https://chromium-review.googlesource.com/1027191 Reviewed-by: Samuel Huang <huangs@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#554909} NOKEYCHECK=True GitOrigin-RevId: 73a64ffde3f3b64df576aa1f2b5baebf7ec964ba
2021-07-23[Zucchini] Add "-keep" flag; remove redundnat CRC32 check.Samuel Huang
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
2021-07-23[Zucchini]: Add Linux RAM metrics to ZucchiniCalder Kitagawa
Reintroduces the PeakPageMemory (Peak Virtual Memory) and PeakWorkingSetSize (Virtual Memory High Water Mark) metrics to Linux builds of Zucchini. Linux is used for benchmarking of ELF and DEX variants of Zucchini as well as general intergration and regression testing so it is nice to have these metrics remain in the program. The method used is based on code in base/process/internal_linux.[h|cc] however, it avoids the overhead of having to create key value pairs for all of the metrics so is slightly faster. Moreover, the contents of internal_linux are intended to be private to base/process so in order to get these metrics it is necessary to replicate part of the code. These were originally removed in: https://chromium-review.googlesource.com/c/chromium/src/+/951923. Also fixes some weirdness with "// defined(...)" comments. Change-Id: Id69f16fa912117f3d3756b425e584c48b9f0fff2 Reviewed-on: https://chromium-review.googlesource.com/963604 Commit-Queue: Calder Kitagawa <ckitagawa@google.com> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#543483} NOKEYCHECK=True GitOrigin-RevId: 20483a8514e95c738aae419e0fa4fe050fd65cfc
2021-07-23[Zucchini] Zucchini-gen: Make number of CreateEquivalenceMap() generations ↵Samuel Huang
depend on Disassembler. The number of CreateEquivalenceMap() iterations used be constant kNumIteraitons = 2. This CL makes the value depend on architecture. Current assignment: - DisassemblerNoOp: 1, since no pointers are identified (though in this case, CreateEquivalenceMap() should not be called). - DisassemblerWin32: 2. Upcoming DisassemblerDex will use 4. Also applying generic cleanups on headers and comments. Bug: 729154 Change-Id: Ia12d98fcba500e4c81c8a5d356ce4cadf424ffde Reviewed-on: https://chromium-review.googlesource.com/961273 Reviewed-by: agrieve <agrieve@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#542919} NOKEYCHECK=True GitOrigin-RevId: 55aea0a875b80e614464fdd157d9717471f9d64f
2021-07-23[Zucchini] Move Zucchini from /chrome/installer/ to /components/.Samuel Huang
(Use "git log --follow" to see older revisions of files). /components/ is the most logical place to put Zucchini, which only depends on /base and /testing/gtest. This move also enables Zucchini to be used by the Component Updater. Details: - Move all files; run the following to change deps and guards: sed 's/chrome\/installer/components/' *.cc *.h -i sed 's/CHROME_INSTALLER/COMPONENTS/' *.cc *.h -i - Sorting works out pretty well! - Change all 'chrome/installer/zucchini' to 'components/zucchini' throughout other parts of the repo; sort if necessary. - Fix 6 'git cl lint' errors. - Change 1 Bind() usage to BindRepeated(). - Update OWNER. Bug: 729154 Change-Id: I50c5a7d411ea85f707b5994ab319dfb2a1acccf7 Reviewed-on: https://chromium-review.googlesource.com/954923 Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#542857} NOKEYCHECK=True GitOrigin-RevId: 577ef6c435e8d43be6e3e60ccbcbd1881780f4ec