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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js

Issue 2431223003: [DevTools]: Require explicit connection (Closed)
Patch Set: Reworked - again Created 4 years, 2 months 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: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js
index 0a2d8db714e87a240de52a7269e22306bad54b79..293178993663b8f6235321bd8396a5f66b327334 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js
@@ -108,8 +108,9 @@ WebInspector.SourcesPanel = function()
WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
+ WebInspector.targetManager.addModelListener(WebInspector.SubTargetsManager, WebInspector.SubTargetsManager.Events.SubTargetConnectionCreated, this._connectionAdded, this)
dgozman 2016/10/28 18:31:35 missing semicolon
eostroukhov 2016/11/01 20:28:15 Done.
new WebInspector.WorkspaceMappingTip(this, this._workspace);
- WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.Events.SidebarPaneAdded, this._extensionSidebarPaneAdded, this);
+ WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.Events.SidebarPaneAdded, this._extensionSidebarPaneAdded);
WebInspector.DataSaverInfobar.maybeShowInPanel(this);
WebInspector.targetManager.observeTargets(this);
};
@@ -125,13 +126,7 @@ WebInspector.SourcesPanel.prototype = {
*/
targetAdded: function(target)
{
- var hasThreads = WebInspector.targetManager.targets(WebInspector.Target.Capability.JS).length > 1;
- if (hasThreads && !this._threadsSidebarPane) {
- this._threadsSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.viewManager.view("sources.threads"));
- if (this._sidebarPaneStack) {
- this._sidebarPaneStack.showView(this._threadsSidebarPane, this._splitWidget.isVertical() ? this._watchSidebarPane : this._callstackPane);
- }
- }
+ this._showThreadsIfNeeded();
},
/**
@@ -142,6 +137,33 @@ WebInspector.SourcesPanel.prototype = {
{
},
+ _connectionAdded: function()
+ {
+ this._showThreadsIfNeeded();
+ },
+
+ /**
+ * @return {boolean}
+ */
+ _hasPendingConnections: function()
+ {
+ for (var target of WebInspector.targetManager.targets(WebInspector.Target.Capability.Target))
dgozman 2016/10/28 18:31:36 {} around body
eostroukhov 2016/11/01 20:28:15 Done.
+ if (WebInspector.SubTargetsManager.fromTarget(target).targetConnections().length > 0)
+ return true;
+ return false;
+ },
+
+ _showThreadsIfNeeded: function()
+ {
+ var hasThreads = WebInspector.targetManager.targets(WebInspector.Target.Capability.JS).length > 1 || this._hasPendingConnections();
dgozman 2016/10/28 18:31:35 I still believe that hasTreads logic belongs to Th
eostroukhov 2016/11/01 20:28:15 Agreed.
+ if (hasThreads && !this._threadsSidebarPane) {
+ this._threadsSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.viewManager.view("sources.threads"));
+ if (this._sidebarPaneStack) {
+ this._sidebarPaneStack.showView(this._threadsSidebarPane, this._splitWidget.isVertical() ? this._watchSidebarPane : this._callstackPane);
+ }
+ }
+ },
+
/**
* @param {?WebInspector.Target} target
*/

Powered by Google App Engine
This is Rietveld 408576698