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

Unified Diff: chrome/browser/resources/task_manager/main.js

Issue 8713016: WebUI TaskManager: Optimize initialization taskmanager and loading scripts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge with master Created 9 years, 1 month 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/task_manager/main.js
diff --git a/chrome/browser/resources/task_manager/main.js b/chrome/browser/resources/task_manager/main.js
index 5df154a73a69e6fd9983d8e05c88c2708c8fa2ab..1b203b7c7b4e75158dbb4275068986137fa01b0c 100644
--- a/chrome/browser/resources/task_manager/main.js
+++ b/chrome/browser/resources/task_manager/main.js
@@ -145,16 +145,17 @@ TaskManager.prototype = {
this.opt_ = opt;
- this.initialized_ = true;
this.enableTaskManager();
this.dialogDom_ = dialogDom;
this.document_ = dialogDom.ownerDocument;
- $('close-window').addEventListener('click', this.close.bind(this));
- $('kill-process').addEventListener('click', this.killProcess.bind(this));
- $('about-memory-link').addEventListener('click',
- this.openAboutMemory.bind(this));
+ var ary = this.dialogDom_.querySelectorAll('[visibleif]');
+ for (var i = 0; i < ary.length; i++) {
+ var expr = ary[i].getAttribute('visibleif');
+ if (!eval(expr))
+ ary[i].hidden = true;
+ }
this.is_column_shown_ = [];
for (var i = 0; i < DEFAULT_COLUMNS.length; i++) {
@@ -203,17 +204,24 @@ TaskManager.prototype = {
dm.setCompareFunction(column_id, compare_func);
}
- var ary = this.dialogDom_.querySelectorAll('[visibleif]');
- for (var i = 0; i < ary.length; i++) {
- var expr = ary[i].getAttribute('visibleif');
- if (!eval(expr))
- ary[i].hidden = true;
- }
-
this.initTable_();
+ this.initialized_ = true;
+ },
+
+ /**
+ * Additional initialization of taskmanager. This function is called when
+ * the loading of delayed scripts finished.
+ * @public
+ */
+ delayedInitialize: function () {
+ $('close-window').addEventListener('click', this.close.bind(this));
+ $('kill-process').addEventListener('click', this.killProcess.bind(this));
+ $('about-memory-link').addEventListener('click',
+ this.openAboutMemory.bind(this));
this.initColumnMenu_();
this.initTableMenu_();
- this.table_.redraw();
+
+ this.isFinishedInitDelayed_ = true;
},
initColumnModel_: function () {
@@ -369,8 +377,10 @@ TaskManager.prototype = {
text.textContent = entry['title'][i];
label.appendChild(text);
- cr.ui.contextMenuHandler.addContextMenuProperty(label);
- label.contextMenu = this.tableContextMenu_;
+ if (this.isFinishedInitDelayed_) {
mazda 2011/11/30 12:05:54 Is it possible to reach here without this.isFinish
yoshiki 2011/12/01 16:18:25 Delayed scripts are loaded with 'defer' property,
+ cr.ui.contextMenuHandler.addContextMenuProperty(label);
+ label.contextMenu = this.tableContextMenu_;
+ }
label.addEventListener('dblclick', (function(uniqueId) {
this.activatePage(uniqueId);

Powered by Google App Engine
This is Rietveld 408576698