Vulcanize MD History to improve page-load performance
Vulcanize is a module which concatenates HTML/JS files together and greatly improves load-time performance for Polymer WebUI pages. This CL generalises the vulcanize script used for MD Downloads so that it can be used for history as well. Also adds uglifyjs to the vulcanize toolchain, which is used to strip excess comments and whitespace from the generated files. The net result is a saving of 25% on the time taken to load the MD History page (average times 1005ms vs 750ms, n=5), but an approximately 450Kb increase to the size of resources.pak. A follow-up CL to strip comments from the vulcanize output will reduce this size increase to 150Kb. BUG=629406 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation NOPRESUBMIT=true TBR=phajdan.jr@chromium.org Review-Url: https://codereview.chromium.org/2224003003 Cr-Commit-Position: refs/heads/master@{#412420}
This commit is contained in:
chrome
browser
test
data
webui
md_history
docs
third_party/polymer/v1_0
tools/copyright_scanner
ui/webui/resources/html
@ -57,6 +57,8 @@ def _CommonChecks(input_api, output_api):
|
||||
|
||||
BLACKLIST = ['chrome/browser/resources/md_downloads/crisper.js',
|
||||
'chrome/browser/resources/md_downloads/vulcanized.html',
|
||||
'chrome/browser/resources/md_history/app.crisper.js',
|
||||
'chrome/browser/resources/md_history/app.vulcanized.html',
|
||||
'chrome/browser/resources/pdf/index.html',
|
||||
'chrome/browser/resources/pdf/index.js']
|
||||
def is_resource(maybe_resource):
|
||||
|
@ -214,40 +214,48 @@
|
||||
<include name="IDR_HISTORY_JS" file="resources\history\history.js" flattenhtml="true" type="BINDATA" />
|
||||
|
||||
<if expr="not is_android and not is_ios">
|
||||
<include name="IDR_MD_HISTORY_APP_HTML" file="resources\md_history\app.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_APP_JS" file="resources\md_history\app.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_BROWSER_SERVICE_HTML" file="resources\md_history\browser_service.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_BROWSER_SERVICE_JS" file="resources\md_history\browser_service.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_CONSTANTS_HTML" file="resources\md_history\constants.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_CONSTANTS_JS" file="resources\md_history\constants.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_GROUPED_LIST_HTML" file="resources\md_history\grouped_list.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_GROUPED_LIST_JS" file="resources\md_history\grouped_list.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_HTML" file="resources\md_history\history.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_ITEM_HTML" file="resources\md_history\history_item.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_ITEM_JS" file="resources\md_history\history_item.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_HTML" file="resources\md_history\history.html" flattenhtml="true" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_JS" file="resources\md_history\history.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_HTML" file="resources\md_history\history_list_behavior.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_JS" file="resources\md_history\history_list_behavior.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_LIST_HTML" file="resources\md_history\history_list.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_LIST_JS" file="resources\md_history\history_list.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML" file="resources\md_history\history_toolbar.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_TOOLBAR_JS" file="resources\md_history\history_toolbar.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_ICONS_HTML" file="resources\md_history\icons.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_PNG" file="resources\md_history\images\100\sign_in_promo.png" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_PNG" file="resources\md_history\images\200\sign_in_promo.png" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_LAZY_RENDER_HTML" file="resources\md_history\lazy_render.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_LAZY_RENDER_JS" file="resources\md_history\lazy_render.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_LIST_CONTAINER_HTML" file="resources\md_history\list_container.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_LIST_CONTAINER_JS" file="resources\md_history\list_container.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SEARCHED_LABEL_HTML" file="resources\md_history\searched_label.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SEARCHED_LABEL_JS" file="resources\md_history\searched_label.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SHARED_STYLE_HTML" file="resources\md_history\shared_style.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SIDE_BAR_HTML" file="resources\md_history\side_bar.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SIDE_BAR_JS" file="resources\md_history\side_bar.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SYNCED_DEVICE_CARD_HTML" file="resources\md_history\synced_device_card.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SYNCED_DEVICE_CARD_JS" file="resources\md_history\synced_device_card.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML" file="resources\md_history\synced_device_manager.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS" file="resources\md_history\synced_device_manager.js" type="BINDATA" />
|
||||
<if expr="use_vulcanize">
|
||||
<then>
|
||||
<include name="IDR_MD_HISTORY_APP_VULCANIZED_HTML" file="resources\md_history\app.vulcanized.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_APP_CRISPER_JS" file="resources\md_history\app.crisper.js" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
|
||||
</then>
|
||||
<else>
|
||||
<include name="IDR_MD_HISTORY_APP_HTML" file="resources\md_history\app.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_APP_JS" file="resources\md_history\app.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_BROWSER_SERVICE_HTML" file="resources\md_history\browser_service.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_BROWSER_SERVICE_JS" file="resources\md_history\browser_service.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_GROUPED_LIST_HTML" file="resources\md_history\grouped_list.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_GROUPED_LIST_JS" file="resources\md_history\grouped_list.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_ITEM_HTML" file="resources\md_history\history_item.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_ITEM_JS" file="resources\md_history\history_item.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_HTML" file="resources\md_history\history_list_behavior.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_JS" file="resources\md_history\history_list_behavior.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_LIST_HTML" file="resources\md_history\history_list.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_LIST_JS" file="resources\md_history\history_list.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML" file="resources\md_history\history_toolbar.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_HISTORY_TOOLBAR_JS" file="resources\md_history\history_toolbar.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_ICONS_HTML" file="resources\md_history\icons.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_LAZY_RENDER_HTML" file="resources\md_history\lazy_render.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_LAZY_RENDER_JS" file="resources\md_history\lazy_render.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_LIST_CONTAINER_HTML" file="resources\md_history\list_container.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_LIST_CONTAINER_JS" file="resources\md_history\list_container.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SEARCHED_LABEL_HTML" file="resources\md_history\searched_label.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SEARCHED_LABEL_JS" file="resources\md_history\searched_label.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SHARED_STYLE_HTML" file="resources\md_history\shared_style.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SIDE_BAR_HTML" file="resources\md_history\side_bar.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SIDE_BAR_JS" file="resources\md_history\side_bar.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SYNCED_DEVICE_CARD_HTML" file="resources\md_history\synced_device_card.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SYNCED_DEVICE_CARD_JS" file="resources\md_history\synced_device_card.js" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML" file="resources\md_history\synced_device_manager.html" type="BINDATA" />
|
||||
<include name="IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS" file="resources\md_history\synced_device_manager.js" type="BINDATA" />
|
||||
</else>
|
||||
</if>
|
||||
</if>
|
||||
|
||||
<include name="IDR_OTHER_DEVICES_JS" file="resources\history\other_devices.js" flattenhtml="true" type="BINDATA" />
|
||||
|
@ -1150,7 +1150,7 @@ cr.define('cr.ui', function() {
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// <include src="../../../../ui/webui/resources/js/assert.js">
|
||||
// <include src-disabled="assert.js">
|
||||
|
||||
/**
|
||||
* Alias for document.getElementById. Found elements must be HTMLElements.
|
||||
|
26
chrome/browser/resources/md_history/PRESUBMIT.py
Normal file
26
chrome/browser/resources/md_history/PRESUBMIT.py
Normal file
@ -0,0 +1,26 @@
|
||||
# Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
||||
def CheckChangeOnUpload(input_api, output_api):
|
||||
"""Warn when changing md_history without vulcanizing."""
|
||||
|
||||
def _is_md_history_file(path):
|
||||
return (path.startswith('chrome/browser/resources/md_history') and
|
||||
(not path.endswith('externs.js')) and
|
||||
(path.endswith('js') or path.endswith('html')))
|
||||
|
||||
def _affects_file(filename, paths):
|
||||
return any([filename in path for path in paths])
|
||||
|
||||
paths = [x.LocalPath() for x in input_api.change.AffectedFiles()]
|
||||
vulcanize_changes = (_affects_file('md_history/app.vulcanized.html', paths) or
|
||||
_affects_file('md_history/app.crisper.js', paths))
|
||||
history_changes = filter(_is_md_history_file, paths)
|
||||
|
||||
if history_changes and not vulcanize_changes:
|
||||
return [output_api.PresubmitPromptWarning(
|
||||
'Vulcanize must be run when changing files in md_history. See '
|
||||
'docs/vulcanize.md.')]
|
||||
return []
|
15318
chrome/browser/resources/md_history/app.crisper.js
Normal file
15318
chrome/browser/resources/md_history/app.crisper.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -272,7 +272,7 @@ Polymer({
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
getSelectedPage_(selectedPage, items) {
|
||||
getSelectedPage_: function(selectedPage, items) {
|
||||
return selectedPage;
|
||||
},
|
||||
|
||||
|
3997
chrome/browser/resources/md_history/app.vulcanized.html
Normal file
3997
chrome/browser/resources/md_history/app.vulcanized.html
Normal file
File diff suppressed because it is too large
Load Diff
@ -78,7 +78,6 @@
|
||||
<command id="delete-command" shortcut="Delete Backspace">
|
||||
<command id="slash-command" shortcut="/">
|
||||
|
||||
<link rel="import" href="chrome://resources/html/cr.html">
|
||||
<link rel="import" href="chrome://resources/html/util.html">
|
||||
<link rel="import" href="chrome://resources/html/load_time_data.html">
|
||||
<link rel="import" href="chrome://history/constants.html">
|
||||
|
@ -1,6 +1,5 @@
|
||||
<link rel="import" href="chrome://resources/html/polymer.html">
|
||||
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout.html">
|
||||
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/hardware-icons.html">
|
||||
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
|
||||
<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html">
|
||||
<link rel="import" href="chrome://resources/polymer/v1_0/paper-tabs/paper-tab.html">
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
# Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
@ -8,14 +8,11 @@ import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
# See //docs/vulcanize.md for instructions on installing prerequistes and
|
||||
# running the vulcanize build.
|
||||
|
||||
_HERE_PATH = os.path.join(os.path.dirname(__file__))
|
||||
|
||||
_HTML_IN_PATH = os.path.join(_HERE_PATH, 'downloads.html')
|
||||
_HTML_OUT_PATH = os.path.join(_HERE_PATH, 'vulcanized.html')
|
||||
_JS_OUT_PATH = os.path.join(_HERE_PATH, 'crisper.js')
|
||||
|
||||
_SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..', '..'))
|
||||
_SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..'))
|
||||
|
||||
_RESOURCES_PATH = os.path.join(_SRC_PATH, 'ui', 'webui', 'resources')
|
||||
|
||||
@ -23,11 +20,10 @@ _CR_ELEMENTS_PATH = os.path.join(_RESOURCES_PATH, 'cr_elements')
|
||||
_CSS_RESOURCES_PATH = os.path.join(_RESOURCES_PATH, 'css')
|
||||
_HTML_RESOURCES_PATH = os.path.join(_RESOURCES_PATH, 'html')
|
||||
_JS_RESOURCES_PATH = os.path.join(_RESOURCES_PATH, 'js')
|
||||
|
||||
_POLYMER_PATH = os.path.join(
|
||||
_SRC_PATH, 'third_party', 'polymer', 'v1_0', 'components-chromium')
|
||||
|
||||
_VULCANIZE_ARGS = [
|
||||
_VULCANIZE_BASE_ARGS = [
|
||||
'--exclude', 'crisper.js',
|
||||
|
||||
# These files are already combined and minified.
|
||||
@ -43,7 +39,6 @@ _VULCANIZE_ARGS = [
|
||||
'--inline-css',
|
||||
'--inline-scripts',
|
||||
|
||||
'--redirect', 'chrome://downloads/|%s' % _HERE_PATH,
|
||||
'--redirect', 'chrome://resources/cr_elements/|%s' % _CR_ELEMENTS_PATH,
|
||||
'--redirect', 'chrome://resources/css/|%s' % _CSS_RESOURCES_PATH,
|
||||
'--redirect', 'chrome://resources/html/|%s' % _HTML_RESOURCES_PATH,
|
||||
@ -53,7 +48,9 @@ _VULCANIZE_ARGS = [
|
||||
'--strip-comments',
|
||||
]
|
||||
|
||||
def main():
|
||||
|
||||
def _vulcanize(directory, host, html_in_file, html_out_file='vulcanized.html',
|
||||
js_out_file='crisper.js', extra_args=None):
|
||||
def _run_cmd(cmd_parts, stdout=None):
|
||||
cmd = "'" + "' '".join(cmd_parts) + "'"
|
||||
process = subprocess.Popen(
|
||||
@ -66,20 +63,43 @@ def main():
|
||||
|
||||
return stdout
|
||||
|
||||
output = _run_cmd(['vulcanize'] + _VULCANIZE_ARGS + [_HTML_IN_PATH])
|
||||
print 'Vulcanizing %s' % directory
|
||||
|
||||
target_path = os.path.join(_HERE_PATH, directory)
|
||||
html_in_path = os.path.join(target_path, html_in_file)
|
||||
html_out_path = os.path.join(target_path, html_out_file)
|
||||
js_out_path = os.path.join(target_path, js_out_file)
|
||||
extra_args = extra_args or []
|
||||
|
||||
output = _run_cmd(['vulcanize'] + _VULCANIZE_BASE_ARGS + extra_args +
|
||||
['--redirect', 'chrome://%s/|%s' % (host, target_path),
|
||||
html_in_path])
|
||||
|
||||
with tempfile.NamedTemporaryFile(mode='wt+', delete=False) as tmp:
|
||||
# Grit includes are not supported, use HTML imports instead.
|
||||
tmp.write(output.replace(
|
||||
'<include src="', '<include src="../../../../ui/webui/resources/js/'))
|
||||
'<include src="', '<include src-disabled="'))
|
||||
|
||||
try:
|
||||
_run_cmd(['crisper', '--source', tmp.name,
|
||||
'--script-in-head', 'false',
|
||||
'--html', _HTML_OUT_PATH,
|
||||
'--js', _JS_OUT_PATH])
|
||||
'--html', html_out_path,
|
||||
'--js', js_out_path])
|
||||
finally:
|
||||
os.remove(tmp.name)
|
||||
|
||||
|
||||
def main():
|
||||
_vulcanize(directory='md_downloads', host='downloads',
|
||||
html_in_file='downloads.html')
|
||||
|
||||
# Already loaded by history.html:
|
||||
history_extra_args = ['--exclude', 'chrome://resources/html/util.html',
|
||||
'--exclude', 'chrome://history/constants.html']
|
||||
_vulcanize(directory='md_history', host='history', html_in_file='app.html',
|
||||
html_out_file='app.vulcanized.html', js_out_file='app.crisper.js',
|
||||
extra_args=history_extra_args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -113,14 +113,26 @@ content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile) {
|
||||
signin_manager->IsAuthenticated();
|
||||
source->AddBoolean("isUserSignedIn", is_authenticated);
|
||||
|
||||
source->AddResourcePath("constants.html", IDR_MD_HISTORY_CONSTANTS_HTML);
|
||||
source->AddResourcePath("constants.js", IDR_MD_HISTORY_CONSTANTS_JS);
|
||||
source->AddResourcePath("images/100/sign_in_promo.png",
|
||||
IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_PNG);
|
||||
source->AddResourcePath("images/200/sign_in_promo.png",
|
||||
IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_PNG);
|
||||
source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS);
|
||||
|
||||
#if BUILDFLAG(USE_VULCANIZE)
|
||||
source->AddResourcePath("app.html",
|
||||
IDR_MD_HISTORY_APP_VULCANIZED_HTML);
|
||||
source->AddResourcePath("app.crisper.js",
|
||||
IDR_MD_HISTORY_APP_CRISPER_JS);
|
||||
#else
|
||||
source->AddResourcePath("app.html", IDR_MD_HISTORY_APP_HTML);
|
||||
source->AddResourcePath("app.js", IDR_MD_HISTORY_APP_JS);
|
||||
source->AddResourcePath("browser_service.html",
|
||||
IDR_MD_HISTORY_BROWSER_SERVICE_HTML);
|
||||
source->AddResourcePath("browser_service.js",
|
||||
IDR_MD_HISTORY_BROWSER_SERVICE_JS);
|
||||
source->AddResourcePath("constants.html", IDR_MD_HISTORY_CONSTANTS_HTML);
|
||||
source->AddResourcePath("constants.js", IDR_MD_HISTORY_CONSTANTS_JS);
|
||||
source->AddResourcePath("grouped_list.html",
|
||||
IDR_MD_HISTORY_GROUPED_LIST_HTML);
|
||||
source->AddResourcePath("grouped_list.js", IDR_MD_HISTORY_GROUPED_LIST_JS);
|
||||
@ -138,12 +150,7 @@ content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile) {
|
||||
IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML);
|
||||
source->AddResourcePath("history_toolbar.js",
|
||||
IDR_MD_HISTORY_HISTORY_TOOLBAR_JS);
|
||||
source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS);
|
||||
source->AddResourcePath("icons.html", IDR_MD_HISTORY_ICONS_HTML);
|
||||
source->AddResourcePath("images/100/sign_in_promo.png",
|
||||
IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_PNG);
|
||||
source->AddResourcePath("images/200/sign_in_promo.png",
|
||||
IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_PNG);
|
||||
source->AddResourcePath("lazy_render.html",
|
||||
IDR_MD_HISTORY_LAZY_RENDER_HTML);
|
||||
source->AddResourcePath("lazy_render.js",
|
||||
@ -168,6 +175,7 @@ content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile) {
|
||||
IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML);
|
||||
source->AddResourcePath("synced_device_manager.js",
|
||||
IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS);
|
||||
#endif // BUILDFLAG(USE_VULCANIZE)
|
||||
|
||||
source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML);
|
||||
source->SetJsonPath("strings.js");
|
||||
|
@ -66,8 +66,12 @@ cr.define('md_history.history_toolbar_test', function() {
|
||||
assertFalse(field.showingSearch, 'Pressing escape closes field.');
|
||||
assertNotEquals(field.$.searchInput, field.root.activeElement);
|
||||
|
||||
var modifier = 'ctrl';
|
||||
if (cr.isMac)
|
||||
modifier = 'meta';
|
||||
|
||||
MockInteractions.pressAndReleaseKeyOn(
|
||||
document.body, 70, 'ctrl', 'f');
|
||||
document.body, 70, modifier, 'f');
|
||||
assertTrue(field.showingSearch);
|
||||
assertEquals(field.$.searchInput, field.root.activeElement);
|
||||
});
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Vulcanizing Material Design downloads
|
||||
# Vulcanizing Chrome Polymer UIs
|
||||
|
||||
`vulcanize` is an npm module used to combine resources. In order to make the
|
||||
Material Design downloads page sufficiently fast, we run vulcanize on the source
|
||||
files to combine them and reduce blocking load/parse time.
|
||||
Material Design downloads and history pages sufficiently fast, we run vulcanize
|
||||
on the source files to combine them and reduce blocking load/parse time.
|
||||
|
||||
## Required software
|
||||
|
||||
@ -24,7 +24,7 @@ We recommend telling npm where to store downloaded modules:
|
||||
$ npm config set -g prefix "$HOME/node_modules"
|
||||
```
|
||||
|
||||
Then install `crisper` and `vulcanize` like this:
|
||||
Then install the required modules:
|
||||
|
||||
```bash
|
||||
$ npm install -g crisper vulcanize
|
||||
@ -35,11 +35,11 @@ Ultimately, all that is required to run this script is that `crisper` and
|
||||
|
||||
## Combining resources with vulcanize
|
||||
|
||||
To combine all the CSS/HTML/JS for the downloads page to make it production
|
||||
fast, you can run the commands:
|
||||
To combine all the CSS/HTML/JS for all pages which use vulcanize, making them
|
||||
production fast, you can run the command:
|
||||
|
||||
```bash
|
||||
$ chrome/browser/resources/md_downloads/vulcanize.py # from src/
|
||||
$ chrome/browser/resources/vulcanize.py # from src/
|
||||
```
|
||||
|
||||
This should overwrite the following files:
|
||||
@ -47,8 +47,10 @@ This should overwrite the following files:
|
||||
- chrome/browser/resources/md_downloads/
|
||||
- vulcanized.html (all <link rel=import> and stylesheets inlined)
|
||||
- crisper.js (all JavaScript, extracted from vulcanized.html)
|
||||
- chrome/browser/resources/md_history/
|
||||
- app.vulcanized.html
|
||||
- app.crisper.js
|
||||
|
||||
## Testing downloads without vulcanizing
|
||||
|
||||
Build with "use_vulcanize=0" in your GYP_DEFINES to build downloads without
|
||||
vulcanizing.
|
||||
Build with `use_vulcanize = false` in your gn args to build without vulcanizing.
|
@ -136,7 +136,8 @@ class UnusedElementsDetector(object):
|
||||
continue
|
||||
|
||||
# Skip generated files that may include the element source.
|
||||
if filename in ('crisper.js', 'vulcanized.html'):
|
||||
if filename in ('crisper.js', 'vulcanized.html',
|
||||
'app.crisper.js', 'app.vulcanized.html'):
|
||||
continue
|
||||
|
||||
with open(os.path.join(dirpath, filename)) as f:
|
||||
|
4
third_party/polymer/v1_0/reproduce.sh
vendored
4
third_party/polymer/v1_0/reproduce.sh
vendored
@ -104,8 +104,8 @@ python create_components_summary.py > components_summary.txt
|
||||
echo 'Creating GYP files for interfaces and externs...'
|
||||
./generate_gyp.sh
|
||||
|
||||
echo 'Vulcanizing dependent UIs (i.e. downloads)...'
|
||||
python ../../../chrome/browser/resources/md_downloads/vulcanize.py
|
||||
echo 'Vulcanizing dependent UIs...'
|
||||
python ../../../chrome/browser/resources/vulcanize.py
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
|
@ -248,6 +248,7 @@ ui/webui/resources/js/cr/ui/array_data_model.js
|
||||
components/test_runner/helper/layout_test_helper_mac.mm
|
||||
# Bundles of existing code.
|
||||
chrome/browser/resources/md_downloads/vulcanized.html
|
||||
chrome/browser/resources/md_history/app.vulcanized.html
|
||||
# Generated config files, which are checked in outside of the third-party
|
||||
# library they configure. Copyright The open-vcdiff Authors; Apache2 license.
|
||||
sdch/ios/config.h
|
||||
|
@ -1 +1,2 @@
|
||||
<link rel="import" href="chrome://resources/html/assert.html">
|
||||
<script src="chrome://resources/js/util.js"></script>
|
||||
|
Reference in New Issue
Block a user