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

Unified Diff: build/android/resource_sizes.py

Issue 2691123002: Android: fix resource_sizes.py strings normalization. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/resource_sizes.py
diff --git a/build/android/resource_sizes.py b/build/android/resource_sizes.py
index c6c015f7b6e5ae9387957760681ddef49c6bdef6..adac46453ecd4458c464cf83c91201bb472dff2b 100755
--- a/build/android/resource_sizes.py
+++ b/build/android/resource_sizes.py
@@ -189,7 +189,7 @@ def GetStaticInitializers(so_path):
return output.splitlines()
-def _NormalizeResourcesArsc(apk_path, num_supported_configs):
+def _NormalizeResourcesArsc(apk_path):
"""Estimates the expected overhead of untranslated strings in resources.arsc.
See http://crbug.com/677966 for why this is necessary.
@@ -201,8 +201,10 @@ def _NormalizeResourcesArsc(apk_path, num_supported_configs):
en_strings = _CreateResourceIdValueMap(aapt_output, 'en-rGB')
fr_strings = _CreateResourceIdValueMap(aapt_output, 'fr')
- # en-US and en-GB configs will never be translated.
- config_count = num_supported_configs - 2
+ # Chrome supports 44 locales (en-US and en-GB will never be translated).
+ # This can be changed to |translations.GetNumEntries()| when Chrome and
+ # WebView support the same set of locales (http://crbug.com/369218).
+ config_count = 42
size = 0
for res_id, string_val in en_strings.iteritems():
@@ -435,8 +437,7 @@ def PrintApkAnalysis(apk_filename, chartjson=None):
# is relative to the average locale .pak.
normalized_apk_size += int(
english_pak.compress_size * num_translations * 1.17)
- normalized_apk_size += int(
- _NormalizeResourcesArsc(apk_filename, num_translations))
+ normalized_apk_size += int(_NormalizeResourcesArsc(apk_filename))
ReportPerfResult(chartjson, apk_basename + '_Specifics',
'normalized apk size', normalized_apk_size, 'bytes')
« 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