Chromium Code Reviews| Index: Source/devtools/front_end/ui/InspectorView.js |
| diff --git a/Source/devtools/front_end/ui/InspectorView.js b/Source/devtools/front_end/ui/InspectorView.js |
| index 8b44ae19b64869f0b2025a3ad286a8aad2a95b69..b12a30cb80b1fcceb597d6250d712067a40b2c40 100644 |
| --- a/Source/devtools/front_end/ui/InspectorView.js |
| +++ b/Source/devtools/front_end/ui/InspectorView.js |
| @@ -48,6 +48,7 @@ WebInspector.InspectorView = function() |
| this._tabbedPane.setRetainTabOrder(true, WebInspector.moduleManager.orderComparator(WebInspector.Panel, "name", "order")); |
| this._tabbedPane.show(this._drawerSplitView.mainElement()); |
| this._drawer = new WebInspector.Drawer(this._drawerSplitView); |
| + this._panels = {}; |
| // Patch tabbed pane header with toolbar actions. |
| this._toolbarElement = document.createElement("div"); |
| @@ -129,15 +130,21 @@ WebInspector.InspectorView.prototype = { |
| /** |
| * @param {string} panelName |
| + * @param {boolean=} skipFallback |
| * @return {?WebInspector.Panel} |
| */ |
| - panel: function(panelName) |
| + panel: function(panelName, skipFallback) |
|
pfeldman
2014/05/06 19:57:14
Either change the naming scheme or make it pure ac
apavlov
2014/05/07 10:26:13
I don't know. AFAIU, the case behind the fallback
|
| { |
| + if (this._panels[panelName]) |
| + return this._panels[panelName]; |
| var panelDescriptor = this._panelDescriptors[panelName]; |
| var panelOrder = this._tabbedPane.allTabs(); |
| - if (!panelDescriptor && panelOrder.length) |
| + if (!skipFallback && !panelDescriptor && panelOrder.length) |
| panelDescriptor = this._panelDescriptors[panelOrder[0]]; |
| - return panelDescriptor ? panelDescriptor.panel() : null; |
| + var panel = panelDescriptor ? panelDescriptor.panel() : null; |
| + if (!this._panels[panelName]) |
| + this._panels[panelName] = panel; |
| + return panel; |
| }, |
| /** |
| @@ -368,7 +375,7 @@ WebInspector.InspectorView.prototype = { |
| this._inHistory = true; |
| this._historyIterator = newIndex; |
| if (!WebInspector.Dialog.currentInstance()) |
| - this.setCurrentPanel(WebInspector.panels[this._history[this._historyIterator]]); |
| + this.setCurrentPanel(this._panels[this._history[this._historyIterator]]); |
| delete this._inHistory; |
| return true; |