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

Side by Side Diff: tools/binary_size/libsupersize/diff.py

Issue 2928783002: Handling disappear or new sections in after.size file (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 """Logic for diffing two SizeInfo objects.""" 4 """Logic for diffing two SizeInfo objects."""
5 5
6 import collections 6 import collections
7 import re 7 import re
8 8
9 import models 9 import models
10 10
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 similar.append(models.Symbol( 175 similar.append(models.Symbol(
176 section_name, padding, 176 section_name, padding,
177 name="** aggregate padding of diff'ed symbols")) 177 name="** aggregate padding of diff'ed symbols"))
178 return models.SymbolDiff(added, removed, similar) 178 return models.SymbolDiff(added, removed, similar)
179 179
180 180
181 def Diff(before, after): 181 def Diff(before, after):
182 """Diffs two SizeInfo objects. Returns a SizeInfoDiff.""" 182 """Diffs two SizeInfo objects. Returns a SizeInfoDiff."""
183 assert isinstance(before, models.SizeInfo) 183 assert isinstance(before, models.SizeInfo)
184 assert isinstance(after, models.SizeInfo) 184 assert isinstance(after, models.SizeInfo)
185 section_sizes = {k: after.section_sizes[k] - v 185 section_sizes = {k: after.section_sizes.get(k, 0) - v
186 for k, v in before.section_sizes.iteritems()} 186 for k, v in before.section_sizes.iteritems()}
187 for k, v in after.section_sizes.iteritems():
188 if k not in section_sizes:
189 section_sizes[k] = v
190
187 symbol_diff = _DiffSymbolGroups(before.raw_symbols, after.raw_symbols) 191 symbol_diff = _DiffSymbolGroups(before.raw_symbols, after.raw_symbols)
188 return models.SizeInfoDiff(section_sizes, symbol_diff, before.metadata, 192 return models.SizeInfoDiff(section_sizes, symbol_diff, before.metadata,
189 after.metadata) 193 after.metadata)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698