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

Unified Diff: chrome/browser/resources/md_history/app.js

Issue 2264983002: MD History: Lazily load element files which are not needed for first paint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor tweaks and rebase Created 4 years, 3 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: chrome/browser/resources/md_history/app.js
diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js
index 13f5e88e674e85131e8572c0e3b5bc3939e0f6f0..8a6d7b51e1a1d5aea360f43d82c39d5490fb89c3 100644
--- a/chrome/browser/resources/md_history/app.js
+++ b/chrome/browser/resources/md_history/app.js
@@ -2,6 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+cr.define('md_history', function() {
+ var lazyLoadPromise = null;
+ function ensureLazyLoaded() {
+ if (!lazyLoadPromise) {
+ lazyLoadPromise = new Promise(function(resolve, reject) {
+ Polymer.Base.importHref(
+ 'chrome://history/lazy_load.html', resolve, reject, true);
+ });
+ }
+ return lazyLoadPromise;
+ }
+
+ return {
+ ensureLazyLoaded: ensureLazyLoaded,
+ };
+});
+
Polymer({
is: 'history-app',
@@ -126,6 +143,9 @@ Polymer({
if (!this.hasDrawer_) {
this.focusToolbarSearchField();
}
+
+ // Lazily load the remainder of the UI.
+ md_history.ensureLazyLoaded();
},
/** Overridden from IronScrollTargetBehavior */

Powered by Google App Engine
This is Rietveld 408576698