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..6e706114fbb1df2190c24ed42dcfdbf086d44ce1 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,32 @@ 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; |
+ |
+ loadDelayedIncludes(this); |
+ }, |
+ |
+ /** |
+ * 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(); |
+ |
+ if (this.delayedInitLabels_) { |
+ while (this.delayedInitLabels_.length > 0) { |
James Hawkins
2011/12/08 18:14:09
No braces for one-link blocks.
yoshiki
2011/12/09 05:51:11
Done.
|
+ this.delayedInitLabels_.pop().call(); |
+ } |
+ } |
+ |
+ this.isFinishedInitDelayed_ = true; |
}, |
initColumnModel_: function () { |
@@ -352,6 +368,8 @@ TaskManager.prototype = { |
}, |
renderColumn_: function(entry, columnId, table) { |
+ this.delayedInitLabels_ = []; |
+ |
var container = this.document_.createElement('div'); |
container.id = 'detail-container-' + columnId + '-pid' + entry.processId; |
container.className = 'detail-container-' + columnId; |
@@ -369,8 +387,15 @@ TaskManager.prototype = { |
text.textContent = entry['title'][i]; |
label.appendChild(text); |
- cr.ui.contextMenuHandler.addContextMenuProperty(label); |
- label.contextMenu = this.tableContextMenu_; |
+ var addContextMenu = function() { |
+ cr.ui.contextMenuHandler.addContextMenuProperty(label); |
+ label.contextMenu = this.tableContextMenu_; |
+ }; |
+ |
+ if (this.isFinishedInitDelayed_) |
+ addContextMenu.call(this); |
+ else |
+ this.delayedInitLabels_.push(addContextMenu.bind(this)); |
label.addEventListener('dblclick', (function(uniqueId) { |
this.activatePage(uniqueId); |