Commit 7638a861 authored by Samuel Huang's avatar Samuel Huang Committed by Commit Bot

[Zucchini] Ensemble patching: Remove explicit separator computation.

Recent refactoring in Zucchini Trunk replaced explicit "separator"
(archive content outside matched elements) computation with "gap"
handling that occurs close to element handling. This CL removes
the now-obsolete explicit separator computation code from Zucchini
Chromium, to prepare for merging in ensemble matching code from
Trunk.

Bug: 729154
Change-Id: I7c917df058e104d8f1d518d37a673edaf0a2918c
Reviewed-on: https://chromium-review.googlesource.com/891443Reviewed-by: default avataragrieve <agrieve@chromium.org>
Reviewed-by: default avatarSamuel Huang <huangs@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532553}
parent 1890a3d1
......@@ -5,7 +5,6 @@
#include "chrome/installer/zucchini/ensemble_matcher.h"
#include <limits>
#include <utility>
#include "base/logging.h"
#include "base/strings/stringprintf.h"
......@@ -22,15 +21,4 @@ void EnsembleMatcher::Trim() {
// TODO(huangs): Add MultiDex handling logic when we add DEX support.
}
void EnsembleMatcher::GenerateSeparators(ConstBufferView new_image) {
ConstBufferView::iterator it = new_image.begin();
for (ElementMatch& match : matches_) {
ConstBufferView new_sub_image(new_image[match.new_element.region()]);
separators_.push_back(
ConstBufferView::FromRange(it, new_sub_image.begin()));
it = new_sub_image.end();
}
separators_.push_back(ConstBufferView::FromRange(it, new_image.end()));
}
} // namespace zucchini
......@@ -39,26 +39,16 @@ class EnsembleMatcher {
// Accessors to RunMatch() results.
const std::vector<ElementMatch>& matches() const { return matches_; }
const std::vector<ConstBufferView>& separators() const { return separators_; }
size_t num_identical() const { return num_identical_; }
protected:
// Post-processes |matches_| to remove potentially unfavorable entries.
void Trim();
// Populates |separators_| from |new_image_| and |matches_|.
void GenerateSeparators(ConstBufferView new_image);
// Storage of matched elements: A list of matched pairs, where the list of
// "new" elements have increasing offsets and don't overlap. May be empty.
std::vector<ElementMatch> matches_;
// Storage of regions before / between (successive) / after |new_ensemble|
// elements in |matches_|, including empty regions. Contains 1 more element
// than |matches_|.
std::vector<ConstBufferView> separators_;
// Number of identical matches found in match candidates. These should be
// excluded from |matches_|.
size_t num_identical_ = 0;
......
......@@ -241,7 +241,6 @@ HeuristicEnsembleMatcher::~HeuristicEnsembleMatcher() = default;
bool HeuristicEnsembleMatcher::RunMatch(ConstBufferView old_image,
ConstBufferView new_image) {
DCHECK(matches_.empty());
DCHECK(separators_.empty());
LOG(INFO) << "Start matching.";
// Find all elements in "old" and "new".
......@@ -364,7 +363,6 @@ bool HeuristicEnsembleMatcher::RunMatch(ConstBufferView old_image,
}
Trim();
GenerateSeparators(new_image);
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment