| 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..ab68bef04af47806bae0beeb017c5c5198a4eea3 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,31 @@ 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)
|
| + this.delayedInitLabels_.pop().call();
|
| + }
|
| +
|
| + this.isFinishedInitDelayed_ = true;
|
| },
|
|
|
| initColumnModel_: function () {
|
| @@ -352,6 +367,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 +386,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);
|
|
|