Commit ba3fb344 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Revert "[about:credits] Improve compression by sorting licenses"

This reverts commit c54fcea4.

Reason for revert: Broke downstream monochrome build.
https://bugs.chromium.org/p/chromium/issues/detail?id=716425

Original change's description:
> [about:credits] Improve compression by sorting licenses
> 
> Restore the alphabetical order in javascript.
> 
> Saves around 100k when gzip is used, but only 2k for brotli.
> Intention is to have android_webview to use the same copy
> of about:credits in a follow-up, in which case this optimization
> becomes relevant.
> 
> BUG=688077
> 
> Change-Id: I24d62a81c61c2c53f5740f90d0c8094d3b04352e
> Reviewed-on: https://chromium-review.googlesource.com/487725
> Reviewed-by: Richard Coles <torne@chromium.org>
> Reviewed-by: Dan Beam <dbeam@chromium.org>
> Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> Commit-Queue: Yipeng Wang <yipengw@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#467537}

TBR=dbeam@chromium.org,torne@chromium.org,agrieve@chromium.org,yipengw@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
BUG=688077

Change-Id: I08d4da9f1c7ab45b15b14973d334feb4485c3ee6
Reviewed-on: https://chromium-review.googlesource.com/490709Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#468152}
parent d8eefcd3
...@@ -23,24 +23,6 @@ function toggle(o) { ...@@ -23,24 +23,6 @@ function toggle(o) {
} }
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
var licenseEls = [].slice.call(document.getElementsByClassName('product'));
licenseEls.sort(function(a, b) {
var nameA = a.getElementsByClassName('title')[0].textContent;
var nameB = b.getElementsByClassName('title')[0].textContent;
if (nameA < nameB) return -1;
if (nameA > nameB) return 1;
return 0;
});
var parentEl = licenseEls[0].parentNode;
parentEl.innerHTML = '';
for (var i = 0; i < licenseEls.length; i++) {
parentEl.appendChild(licenseEls[i]);
}
document.body.hidden = false;
if (cr.isChromeOS) { if (cr.isChromeOS) {
var keyboardUtils = document.createElement('script'); var keyboardUtils = document.createElement('script');
keyboardUtils.src = 'chrome://credits/keyboard_utils.js'; keyboardUtils.src = 'chrome://credits/keyboard_utils.js';
......
...@@ -59,7 +59,7 @@ body { ...@@ -59,7 +59,7 @@ body {
} }
</style> </style>
</head> </head>
<body hidden> <body>
<span class="page-title" style="float:left;">Credits</span> <span class="page-title" style="float:left;">Credits</span>
<a id="print-link" href="#" style="float:right;">Print</a> <a id="print-link" href="#" style="float:right;">Print</a>
<div style="clear:both; overflow:auto;"><!-- Chromium <3s the following projects --> <div style="clear:both; overflow:auto;"><!-- Chromium <3s the following projects -->
...@@ -68,4 +68,4 @@ body { ...@@ -68,4 +68,4 @@ body {
<script src="chrome://resources/js/cr.js"></script> <script src="chrome://resources/js/cr.js"></script>
<script src="chrome://credits/credits.js"></script> <script src="chrome://credits/credits.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -602,11 +602,8 @@ def GenerateCredits( ...@@ -602,11 +602,8 @@ def GenerateCredits(
'license_file': metadata['License File'], 'license_file': metadata['License File'],
} }
entries.append(entry) entries.append(entry)
# Sort by size in order to improve gzip compression ratio (puts similar
# licenses near each other). The licenses are re-sorted by the JavaScript
# when loaded.
entries.sort(key=lambda entry: len(entry['content']))
entries.sort(key=lambda entry: (entry['name'], entry['content']))
entries_contents = '\n'.join([entry['content'] for entry in entries]) entries_contents = '\n'.join([entry['content'] for entry in entries])
file_template = open(file_template_file).read() file_template = open(file_template_file).read()
template_contents = "<!-- Generated by licenses.py; do not edit. -->" template_contents = "<!-- Generated by licenses.py; do not edit. -->"
......
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