Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: src/platform/update_engine/graph_utils.cc

Issue 891002: AU: Delta Diff Generator (Closed)
Patch Set: fixes for review Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/update_engine/graph_utils.cc
diff --git a/src/platform/update_engine/graph_utils.cc b/src/platform/update_engine/graph_utils.cc
index 79d573332b61bc669da4d69dd32b0af69ff91986..dd3cdcf19349e98d0d16c135eb16d94afdb1f021 100644
--- a/src/platform/update_engine/graph_utils.cc
+++ b/src/platform/update_engine/graph_utils.cc
@@ -17,7 +17,8 @@ uint64 EdgeWeight(const Graph& graph, const Edge& edge) {
graph[edge.first].out_edges.find(edge.second)->second.extents;
for (vector<Extent>::const_iterator it = extents.begin();
it != extents.end(); ++it) {
- weight += it->num_blocks();
+ if (it->start_block() != kSparseHole)
+ weight += it->num_blocks();
}
return weight;
}
@@ -25,7 +26,15 @@ uint64 EdgeWeight(const Graph& graph, const Edge& edge) {
void AppendBlockToExtents(vector<Extent>* extents, uint64 block) {
if (!extents->empty()) {
Extent& extent = extents->back();
- if (extent.start_block() + extent.num_blocks() == block) {
+ if (block == kSparseHole) {
+ if (extent.start_block() == kSparseHole) {
+ // Extend sparse hole extent
+ extent.set_num_blocks(extent.num_blocks() + 1);
+ return;
+ } else {
+ // Create new extent below outer 'if'
+ }
+ } else if (extent.start_block() + extent.num_blocks() == block) {
extent.set_num_blocks(extent.num_blocks() + 1);
return;
}
« no previous file with comments | « src/platform/update_engine/graph_types.h ('k') | src/platform/update_engine/postinstall_runner_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698