Commit 7a9e12f9 authored by luoe's avatar luoe Committed by Commit bot

DevTools: TabbedLocations only materialize tabs when needed

TabbedLocations used to materialize tab contents on tabSelected. Now,
they materialize only if the tab is selected while the TabbedPane is showing, or
when the TabbedPane is being shown.

BUG=none

Review-Url: https://codereview.chromium.org/2617293002
Cr-Commit-Position: refs/heads/master@{#442824}
parent 1f8e11ba
...@@ -442,6 +442,13 @@ UI.ViewManager._ContainerWidget = class extends UI.VBox { ...@@ -442,6 +442,13 @@ UI.ViewManager._ContainerWidget = class extends UI.VBox {
this._materializePromise = Promise.all(promises); this._materializePromise = Promise.all(promises);
return this._materializePromise; return this._materializePromise;
} }
/**
* @override
*/
wasShown() {
this._materialize();
}
}; };
/** /**
...@@ -709,7 +716,8 @@ UI.ViewManager._TabbedLocation = class extends UI.ViewManager._Location { ...@@ -709,7 +716,8 @@ UI.ViewManager._TabbedLocation = class extends UI.ViewManager._Location {
this.appendView(view, insertBefore); this.appendView(view, insertBefore);
this._tabbedPane.selectTab(view.viewId()); this._tabbedPane.selectTab(view.viewId());
this._tabbedPane.focus(); this._tabbedPane.focus();
return this._materializeWidget(view); var widget = /** @type {!UI.ViewManager._ContainerWidget} */ (this._tabbedPane.tabView(view.viewId()));
return widget._materialize();
} }
/** /**
...@@ -737,8 +745,6 @@ UI.ViewManager._TabbedLocation = class extends UI.ViewManager._Location { ...@@ -737,8 +745,6 @@ UI.ViewManager._TabbedLocation = class extends UI.ViewManager._Location {
if (!view) if (!view)
return; return;
this._materializeWidget(view);
if (view.isCloseable()) { if (view.isCloseable()) {
var tabs = this._closeableTabSetting.get(); var tabs = this._closeableTabSetting.get();
if (!tabs[tabId]) { if (!tabs[tabId]) {
...@@ -760,15 +766,6 @@ UI.ViewManager._TabbedLocation = class extends UI.ViewManager._Location { ...@@ -760,15 +766,6 @@ UI.ViewManager._TabbedLocation = class extends UI.ViewManager._Location {
} }
} }
/**
* @param {!UI.View} view
* @return {!Promise}
*/
_materializeWidget(view) {
var widget = /** @type {!UI.ViewManager._ContainerWidget} */ (this._tabbedPane.tabView(view.viewId()));
return widget._materialize();
}
/** /**
* @param {!Common.Event} event * @param {!Common.Event} event
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment